php rsvp form |
php rsvp form |
xxkasperxx |
Jul 5 2011, 08:39 PM
Post
#1
|
Serious Coder Group: Members Posts: 261 Joined: 30-April 11 Member No.: 14,449 |
i feel stupid asking so many questions on here, but this is a key component to a new site of mine. A RSVP page, it just needs to say "Your Name:" and have 2 radio buttons that say "yes" "no" and have a submit button. please help
send_mail.php: CODE <?php /* This first bit sets the email address that you want the form to be submitted to. You will need to change this value to a valid email address that you can access. */ $webmaster_email = "modinghere@yahoo.com"; /* This bit sets the URLs of the supporting pages. If you change the names of any of the pages, you will need to change the values here. */ $feedback_page = "feedback_form.html"; $error_page = "error_message.html"; $thankyou_page = "thank_you.html"; /* This next bit loads the form field data into variables. If you add a form field, you will need to add it here. */ $name = $_REQUEST['name']; /* The following function checks for email injection. Specifically, it checks for carriage returns - typically used by spammers to inject a CC list. */ function isInjected($str) { $injections = array('(\n+)', '(\r+)', '(\t+)', '(%0A+)', '(%0D+)', '(%08+)', '(%09+)' ); $inject = join('|', $injections); $inject = "/$inject/i"; if(preg_match($inject,$str)) { return true; } else { return false; } } // If the user tries to access this script directly, redirect them to the feedback form, if (!isset($_REQUEST['email_address'])) { header( "Location: $feedback_page" ); } // If the form fields are empty, redirect to the error page. elseif (empty($email_address) || empty($comments)) { header( "Location: $error_page" ); } // If email injection is detected, redirect to the error page. elseif ( isInjected($email_address) ) { header( "Location: $error_page" ); } // If we passed all previous tests, send the email then redirect to the thank you page. else { mail( "$webmaster_email", "Feedback Form Results", $comments, "From: $name" ); header( "Location: $thankyou_page" ); } ?> feedback_form.html: CODE <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Your Wedding</title> <link href="css/reset.css" type="text/css" rel="stylesheet" /> <link rel="stylesheet" type="text/css" href="css/main.css" /> <title>Your Wedding</title> </head> <body id="sector1"> <div id="nav-bar"> <div class="about"> <!-- Nav Bar Text --> <ul> <li><a href="index.html" class="links">About Us</a></li> <li><a href="registry.html" class="links">Registry</a></li> <li><a href="password_protect.php" class="links">When + Where</a></li> <li><a href="rsvp.php" class="links">Rsvp</a></li> </ul> </div> </div> <div class="rsvp-details"> <h2>RSVP</h2> <form action="send_mail.php" method="post"> <table> <tr> <br /><td>Your Name: </td> <td> <input type="text" name="name" value="" maxlength="100" /> </td> </tr> <tr> <tr><td> </td> <td> <br /><input type="submit" value="Submit" /> </td> </tr> </table> </form> </div> </body> </html> |
Brian Chandler |
Jul 6 2011, 01:44 AM
Post
#2
|
Jocular coder Group: Members Posts: 2,460 Joined: 31-August 06 Member No.: 43 |
QUOTE i feel stupid asking so many questions on here, but this is a key component to a new site of mine. A RSVP page, it just needs to say "Your Name:" and have 2 radio buttons that say "yes" "no" and have a submit button. please help Nothing wrong with asking lots of questions, but htmlhelp is basically for helping others to do something. It's really not clear if you are asking for help with what you are doing, or whether you want someone else to do it for you. If you have a form to email script, it's normally trivial to add in any bits of information, such as input from a radio button. What more do you need to know? Incidentally "A RSVP..." should be "An RSVP..." -- just read it out! |
Lo-Fi Version | Time is now: 18th April 2024 - 08:29 AM |