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

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.