Carin Posted March 17, 2014 Share Posted March 17, 2014 Hallo there! I am a complete PHP noob so please go easy on me What I need to do is the following: an invitation mail goes out and people click on a link to RSVP and is taken to this page: http://www.menusolutions.co.za/webpage-save-the-date.html Here people tick a radio box to say either "Yes" or "No" and they fill in their name(s). If they say "Yes", a mail should be sent with the Yes answer plus the names they entered and they should redirect to this page to thank them for their submission: http://www.menusolutions.co.za/anch_yes.html Should they tick "No", a mail should be sent that contains the "No" answer plus the name the user has entered and be redirected to this page to say sorry that they will not be attending: http://www.menusolutions.co.za/anch_no.html I also have an error page if they have not selected anything: http://www.menusolutions.co.za/anch_error.html What I need help with, please, is the PHP that compiles the mail. I was advised to have 3 PHP files - the first "deciding-mailer.php" simply test for Yes or No and then directs to another php file for Yes and yet another for No - here is where I fall down - when I select Yes or No and enter the names, it goes through to the correct response page, but I receive no email. I am also a bit worried about validation, of which there is none at the moment, so even if I enter no names, it still goes to the response page, so I would need to validate for no entries and then redirect to the error page. I attach my php files. Could you please be so kind as to let me know where I have gone wrong / what I am missing? Please treat me as a complete idiot deciding-mailer.php no.php yes.php Quote Link to comment Share on other sites More sharing options...
Ansego Posted March 17, 2014 Share Posted March 17, 2014 Hi, these maybe of help: Refer to php mail http://au2.php.net/manual/en/function.mail.php Refer to php validation http://www.php.net/manual/en/filter.filters.validate.php Refer to php Sanitize filters http://www.php.net/manual/en/filter.filters.sanitize.php Quote Link to comment Share on other sites More sharing options...
Carin Posted March 19, 2014 Author Share Posted March 19, 2014 Thank you for the reply, I shall check out the links! Quote Link to comment Share on other sites More sharing options...
Ansego Posted March 19, 2014 Share Posted March 19, 2014 (edited) Hi again Carin; Reviewed your code again... Create a *.php page and send your radio form to it: (CODE NOT TESTED!!!) Have a play around see how you go... $webmaster_email = "carin@menusolutions.co.za"; $to = '$webmaster_email'; $subject = '< Subject goes here >'; $headers = 'From: $webmaster_email' . "\r\n" . 'Reply-To: $webmaster_email' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); if (isset($_POST['ja_nee'])){ $ja_nee = $_POST['ja_nee']; }else{ $ja_nee = ""; } if ($ja_nee == 'Yes'){ // YES $message = "Ja-of-Nee: <Message goes here>"; mail($to, $subject, $message, $headers); $thankyou_page = "anch_yes.html"; header( "Location: $thankyou_page" ); } else if ($ja_nee == 'No'){ // NO $message = "Ja-of-Nee: <Message goes here>"; mail($to, $subject, $message, $headers); $thankyou_page = "anch_no.html"; header( "Location: $thankyou_page" ); } Edited March 19, 2014 by Ansego Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.