SitePoint Sponsor |
|
User Tag List
Results 1 to 4 of 4
-
Mar 26, 2009, 13:18 #1
- Join Date
- Mar 2008
- Posts
- 135
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Need help getting "Radio Button Options" to pass through in PHP email form.
Hello,
Here is my code of the Form File:
PHP Code:<form action="form_handler.php" method="post" name="form1" id="form1">
<span class="style12"><br>
<strong>A Day of Renewal for Women</strong><br>
Led by the Rev. Joyce Payne, Conference evangelist of the South Georgia
Conference of The United Methodist Church.<br>
<br>
<strong>Saturday, April 4</strong><br>
9:30 a.m.-12:00 noon<br>
Lunch will be served afterward. Bring your Bibles! <br>
<br>
Full Name<br>
<input style="background-color:#D4F3F7;" size="35" id="name" type="text" name="name">
<br>
<br>
Email Address
<br>
<input style="background-color:#D4F3F7;" size="35" id="email_address" type="text" name="email_address">
<br>
<br>
Special Needs (dietary restrictions, wheelchair, etc.)
<br>
<input style="background-color:#D4F3F7;" size="35" id="special_needs" type="text" name="special_needs">
<br>
<br>
Staying For Lunch?
<br>
<input value="lunch_Yes" type="radio" name="lunch_yes">
Yes <br>
<input value="lunch_no" type="radio" name="lunch_no">
No
<br>
<br>
<br>
<input value="Register Now" id="submit_prayer_request" class="style12Bold" type="submit" name="submit_prayer_request">
</span>
<br>
<br>
</form>
Here is my PHP processing file:
PHP Code:<?php
$name = $_REQUEST['SSN'] ;
$email_address = $_REQUEST['FirstName'] ;
$special_needs = $_REQUEST['LastName'] ;
$lunch_yes = $_REQUEST['MiddleName'] ;
$lunch_no = $_REQUEST['email'] ;
header ("Location: thankyou.html");
$content = <<<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD Xhtml 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body {
font-family: Arial;
font-size: 12px;
}
h2 {
font-family: Georgia;
font-size: 14px;
color: blue;
margin-bottom: 0px;
}
H3 {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
font-weight: bolder;
margin-bottom: 5px;
}
</style>
<title>Reservation Form</title>
</head>
<body>
<table width="500px">
<tr>
<td>Full Name:</td>
<td>{$name}</td>
</tr>
<tr>
<td>Email Address:</td>
<td>{$email_address}</td>
</tr>
<tr>
<td>Special Needs:</td>
<td>{$special_needs}</td>
</tr>
<tr>
<td>Lunch:</td>
<td>{$lunch_yes} or {$lunch_no}</td>
</tr>
</table>
</body>
</html>
HTML;
mail( "email@domain.com", "Reservation from Company", $content, "From:email@domain.com\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n");
Everything goes through with no problem to my email, except I cannot get the radio buttons that are checked to tell me what it is they checked.
Thank you!
-
Mar 26, 2009, 13:29 #2
- Join Date
- Jul 2008
- Posts
- 213
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Your lunch radio button names should both be "lunch". Then in your PHP you will
PHP Code:$lunch = $_REQUEST['lunch'];
You should have this:
PHP Code:$name = $_REQUEST['name'] ;
$email_address = $_REQUEST['email_address'] ;
$special_needs = $_REQUEST['special_needs'] ;
$lunch = $_REQUEST['lunch'] ;
PHP Code:mail( "email@domain.com", "Reservation from Company", $content, "From:$email_address\r\nMIME-Version: 1.0\r\nContent-type: text/html; charset=iso-8859-1\r\n");
header ("Location: thankyou.html");
exit;
-
Mar 26, 2009, 13:34 #3
- Join Date
- Jul 2005
- Location
- West Springfield, Massachusetts
- Posts
- 17,290
- Mentioned
- 198 Post(s)
- Tagged
- 3 Thread(s)
Are you sure this is working at all?
The form has the inputs
- name
- email_address
- special_needs
- lunch_yes
- lunch_no
- submit_prayer_request
(*Because the "lunch" radios have different names, they're checkboxes, not "radio buttons" as you mean them to be.)
But the code is using
PHP Code:$name = $_REQUEST['SSN'] ;
$email_address = $_REQUEST['FirstName'] ;
$special_needs = $_REQUEST['LastName'] ;
$lunch_yes = $_REQUEST['MiddleName'] ;
$lunch_no = $_REQUEST['email'] ;
BTW, if you are sending POST do you really want to use REQUEST which would allow someone to type in an HTTP request using GET variables?Big Change Coming Soon - if you want your PMs save them now!
What you need to do to prepare for our migration to Discourse
A New SitePoint Forum Experience: Our Move to Discourse
-
Mar 26, 2009, 13:42 #4
- Join Date
- Jul 2008
- Posts
- 213
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Ooops.
PHP Code:$name = $_POST['name'] ;
$email_address = $_POST['email_address'] ;
$special_needs = $_POST['special_needs'] ;
$lunch = $_POST['lunch'] ;
Bookmarks