robcatsurrey Posted April 18, 2017 Share Posted April 18, 2017 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 Quote Link to comment Share on other sites More sharing options...
ginerjm Posted April 18, 2017 Share Posted April 18, 2017 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. 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.