jonnyroboto Posted April 20, 2009 Share Posted April 20, 2009 I have created a form and have set up all the appropriate php docs to process and even verify captcha. I have sucessfully redirected my guests to a new window containing the form and even a thank you page on submission. The form even sends me emails but: 1: the formatting of the mail is very confusing and 2: I have check boxes that aren't being recognized and recorded on my form. here is the code for my form: <?php echo ' <body bgcolor="#9999cc"> <form action="sendmail.php" method="post"> <font face="Arial, Helvetica, sans-serif"> <h1 align="center"><font size="5" color="#FFFFFF">Contact Us</font></h1> <div align="center"> <font size="2"><strong> <font color="#FFFFFF"> Name:</font></strong> <input type="text" name="name" size="30" /> </font> <br /> <br /> <font size="2"><font color="#FFFFFF"><strong>* Email:</strong></font> <input type="text" name="email" size="30" /> </div> <br /> <div align="center"> <font color="#FFFFFF"> <strong>Overall Rating of the site:</strong><br/> [<input checked="checked" name="rating" type="radio" value="good" />Good] [<input name="rating" type="radio" value="bad" />Fair] [<input name="rating" type="radio" value="ugly" />Bad]</font> <br /> <br /> <table> <tr> <td> <p align="left"><font color="#FFFFFF" size="2"><strong>* What can we help you with?</strong><br /> <input type="checkbox" name="info_needed" value="Hotel Information and Reservations" />Hotel Information and Reservations<br /> <input type="checkbox" name="info_needed" value="Vacation Home Information and Reservations" />Vacation Home Information and Reservations<br /> <input type="checkbox" name="info_needed" value="Vacation Packages and Tickets" />Vacation Packages and Tickets<br /> <input type="checkbox" name="info_needed" value="Affiliate Program Information" />Affiliate Program<br /> <input type="checkbox" name="info_needed" value="Other Information" />Other </font> <font color="#FFFFFF"><input type="text" name="other_detail" size="20" /></font></p> </td> </tr> </table> <font color="#FFFFFF"> <br /> <font size="1"><i>* Required Fields</i></font> <br /> <h2 align="center"><font color="#FFFFFF">Comments</font></h2> <div align="center"> <font face="Arial, Helvetica, sans-serif"><textarea name="feedback" rows="6" cols="30"></textarea></font> </div> <hr /> '; ?> <?php require_once('recaptchalib.php'); $publickey = "..."; // you got this from the signup page echo recaptcha_get_html($publickey); ?> <?php echo ' <br /><input type="submit" /> </form></body> '; ?> and here is the code for my processing page: <?php require_once('recaptchalib.php'); $privatekey = "..."; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { die ("The reCAPTCHA wasn’t entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } $name = $_REQUEST['name'] ; $email = $_REQUEST['email'] ; $rating = $_REQUEST['rating'] ; $info_needed = $_REQUEST['info_needed'] ; $other_detail = $_REQUEST['other_detail'] ; $feedback = $_REQUEST['feedback'] ; $embody = "$name $rating $info_needed $other_detail $feedback" ; mail( "[email protected]", "Contact Form", $embody = "$name $rating $info_needed $other_detail $feedback", "From: $email" ); header( "Location: http://www.wdwvip.com/thankyou.htm" ); ?> Can anyone tell me what I'm doing wrong with my info_needed parameter and is there a simple way to format the results of my form so that they don't just follow one another in my emails (i.e. name rating feedback, all separated by spaces with no commas or anything) Thank you, Link to comment https://forums.phpfreaks.com/topic/154921-problem-with-form-information/ Share on other sites More sharing options...
mrMarcus Posted April 20, 2009 Share Posted April 20, 2009 ok... first off, lose $_REQUEST and replace with $_POST. you can either name each checkbox differently, or create an array by adding [] to the name, ie. info_needed[], and then format the array as you wish before mailing. to add spaces, you can do something like this : $name.' '.$rating.' '. $info_needed and so on... let me know how that works out. Link to comment https://forums.phpfreaks.com/topic/154921-problem-with-form-information/#findComment-814924 Share on other sites More sharing options...
jonnyroboto Posted April 21, 2009 Author Share Posted April 21, 2009 great! Thank you. So by replacing $_REQUEST with $_POST, what will that do? Link to comment https://forums.phpfreaks.com/topic/154921-problem-with-form-information/#findComment-815669 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.