I am currently moving a website thats in static HTML to a CMS system The site has a regular form that is working on the old site but not on the new one It is posting to the document OK but in the email its mention to send me it is not giving me info from the fields. Instead I get an email with s: email, s: message and so on Other than that the form is working I am getting the thankyou page and the email confirmation But I am not been sent the info Does this s: email mean anything Thanks
well this is the full code but as I said I have the code on another <?php $to = 'info6@mail.com' ; $from = $_REQUEST['Email'] ; $name = $_REQUEST['Name'] ; $subject =$_REQUEST ['subject']; $occupation =$_REQUEST ['occupation']; $readbook =$_REQUEST ['readbook']; $message = $_REQUEST['message']; $tandc =$_REQUEST ['tandc']; $headers = "From: $from"; $subject = "email recieved"; $fields = array(); $fields{"Name"} = "Name"; $fields{"subject"} = "subject"; $fields{"occupation"} = "occupation"; $fields{"readbook"} = "readbook"; $fields{"message"} = "message"; $fields{"Email"} = "Email"; $fields{"tandc"} = "tandc"; $body = "We have received the following information:\n\n"; foreach($fields as $a => $b){ $body .= sprintf(" s: %s\n",$b,$_REQUEST[$a]); } $headers2 = "From: noreply@xxxl.com"; $subject2 = "Thanks for you email"; $autoreply = "Thank you for contacting us. A response will be sent to you within one week. We thank you for your patience."; if($name == '') {print "You have not entered a name, please go back and try again";} else { if($subject == '') {print "please select a subject and try again";} else { if($occupation == '') {print "please select an occupation";} else { if($readbook == '') {print "please say if you have read the book";} else { if($from == '') {print "You have not entered an email, please go back and try again";} else { if($message== '') {print "Please enter your comments or questions and try again";} else { if($tandc== '') {print "Please agree to the terms and conditions";} else { $send = mail($to, $subject, $body, $headers); if($send) {header( "Location: http://www.xxl.com/thankyou.php" );} else {print "We encountered an error sending your mail, please try again later"; } } } } } } } } ?> PHP:
Vow, some weird syntax for adding elements to array, usually it's $array['key'] = 'value'; Anyway, the problem is in this line: $body.=sprintf(" s: %s\n",$b,$_REQUEST[$a]); //should be this $body.=sprintf(" %s: %s\n",$b,$_REQUEST[$a]); PHP:
$body.=sprintf(" s: %s\n",$b,$_REQUEST[$a]); //should be this $body.=sprintf(" %s: %s\n",$b,$a); PHP: Good Luck