Jump to content

Form submission and mailing


Carin

Recommended Posts

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:


 

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:


 

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:


 

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 :P

deciding-mailer.php

no.php

yes.php

Link to comment
Share on other sites

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 by Ansego
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.