Jump to content

PHP Mail RSVP Form


robcatsurrey

Recommended Posts

I am struggling to create a PHP that will successfully send the form data from a HTML RSVP form via email.

This is my form script:

 

<form method="post" action="rsvp.php">
Name:
<input type="text" name="name"><P>
E-mail:
<input type="text" name="email"><P> 
I will be attending: <select name="attending">
<option value="select">Please select...</option>
<option value="Ceremony">Ceremony</option>
<option value="Meal">Wedding Meal</option>
<option value="Reception">Evening Reception</option>
<option value="Ceremony-evening Reception">Ceremony/Evening Reception</option>
<option value="All">All of the Above</option>
<option value="Unable to Attend">I Am Unable to Attend</option>
</select><P>
Number of Guests:
<input type="text" name="guests" size="5"><P>
Additional Comments (e.g. Dietary Requirements):<P>
<input type="text" name="comments" size="20"><P>
<input type="submit" value="RSVP">
<input type="reset" value="Reset">
</font>
</form>
 
This is the PHP I've tried:
 
<?php
mail( "the@email.com",
        "Title of Message",
        'Name: '.$_POST['name'].'/n/n'.'Email: '.$_POST['email'].'/n/n'.'Attending: '.$_POST['attending'].'/n/n'.'Guest: '.$_POST['guest'].'/n/n'.'Comments: '.$_POST['comments'].');
?>

 

 

The script runs but doesn't send...

Where am I going wrong?

 

Thanks,

Rob

Link to comment
Share on other sites

How do you know the script runs?

 

Turn on php error checking as in my signature and then see what is happening. :)

 

You really need to learn some stuff. You are not checking for a completed form at all. You are just blindly accepting the input and creating an email call with it. Plus - IF YOU READ THE MANUAL - you would see that your mail() call is malformed since you don't have any header specified so it may not actually ever get sent, unless you have something in your .ini file for this.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.