I have set up the following form to (a) email confirmation to the user (b) email form input to my address (c) redirect to another page "attendee.html" on submit.
I had to edit the form to include radio buttons "giss1" and "giss2" and I am having trouble having those results seen in the emails.
Here's the code:
I'm a PHP amateur and have been working on this project for hours so now it's all starting to look like gibberish.Code:<?php if(($_POST['college']=="")||($_POST['streetaddress']=="")||($_POST['city']=="")||($_POST['zip']=="")||($_POST['state']=="")||($_POST['contactperson']=="")||($_POST['contactemail']=="")||($_POST['phone']=="")||($_POST['fax']=="")||($_POST['giss1']=="")||($_POST['giss2']=="")) { echo "<html><body><p>The following fields are <strong>required</strong>.</p><ul>"; if($_POST['college'] == ""){ echo "<li>*College</li>"; } if($_POST['streetaddress'] == ""){ echo "<li>*Street Address</li>"; } if($_POST['city'] == ""){ echo "<li>*City</li>"; } if($_POST['zip'] == ""){ echo "<li>*Zip</li>"; } if($_POST['state'] == ""){ echo "<li>*State</li>"; } if($_POST['contactperson'] == ""){ echo "<li>*Contact Person</li>"; } if($_POST['contactemail'] == ""){ echo "<li>*Contact Email</li>"; } if($_POST['phone'] == ""){ echo "<li>*Phone</li>"; } echo "</ul><p>Please use your browsers <a href=\"javascript:history.back();\">Back</a> button and fill out these fields.</p></body></html>"; } if(isset($_POST['submit'])) { $to = "my@email.com"; $subject = "Contact Has Registered"; $college = $_POST['college']; $streetaddress = $_POST['streetaddress']; $city = $_POST['city']; $state = $_POST['state']; $contactperson = $_POST['contactperson']; $contactemail = $_POST['contactemail']; $phone = $_POST['phone']; if ($selected_radio == 'giss1') { $giss1_status = 'checked'; } else if ($selected_radio == 'giss2') { $giss2_status = 'checked'; } $body = "From: $college Street Address: $streetaddress E-Mail: $contactemail Phone Number: $phone Contact Email: $contactemail GISS Session: $selected_radio"; echo "We've recived your contact information $to! We will be in Contact with you shortly!" ; mail($to, $subject, $body); //These are the variables for the email $sendto = $_POST['contactemail']; // this is the email address collected form the form $ccto = "my@email.com"; //you can cc it to yourself $subject = "Registration"; // Subject $message = "Thank you for registering. Here are the registration details you have provided: You are registered for:$selected_radio College:$college Address:$streetaddress City:$city State:$state Contact Person:$contactperson Contact Email:$contactemail ......."; // This is the function to send the email if(mail($sendto, $subject, $message, $header)) header("location: attendee.html"); } ?> <script type=text/javascript> setTimeout("location.href='index.html'", [3000]); </script>
Thanks so much!



Reply With Quote



Bookmarks