Page 1 of 1

Convert radio button value

Posted: Wed Dec 02, 2009 9:18 pm
by jeffimperial
Hey guys. It's been quite some time since I last asked a question, so I hope someone can help me.

I've got this simple form on a WP page, and all it does basically is Email me the content of the form and redirect the visitor to a thank you page after. This is the PHP script that processes the form:

Code: Select all

 
<?php 
$to = "me@mywebsite.com"; 
$subject = "Email From My Website"; 
$email = $_REQUEST['email'] ; 
$firstname = $_REQUEST['firstname'] ; 
$lastname = $_REQUEST['lastname'] ; 
$phone = $_REQUEST['phone'] ; 
$sydney = $_REQUEST['radio1'] ; // This is a radio button
$kuala = $_REQUEST['radio2'] ;     // This is a radio button
$jakarta = $_REQUEST['radio3'] ;      // This is a radio button
$surabaya = $_REQUEST['radio4'] ;      // This is a radio button
$hongkong = $_REQUEST['radio5'] ;      // This is a radio button
$singapore = $_REQUEST['radio6'] ;      // This is a radio button
$guestfirstname = $_REQUEST['guestfirstname'] ; 
$guestlastname = $_REQUEST['guestlastname'] ; 
$guestemail = $_REQUEST['guestemail'] ; 
$guestphone = $_REQUEST['guestphone'] ; 
 
$message = "CUSTOM MESSAGE WITH THE ABOVE $variables GOES HERE" ; 
$headers = "From: $email"; 
$sent = mail($to, $subject, $message, $headers) ; 
if($sent) 
{header( "Location: http://www.site.com/thankyou" );} 
else 
{print "We encountered an error sending your mail"; }
?>
Question: How do I go about making $radio1, $radio2, etc... to print out a custom string instead of "on" or null ?

Thanks in advance for any help!

Re: Convert radio button value

Posted: Thu Dec 03, 2009 2:38 am
by Marinusjvv

Code: Select all

<input name="radiobutton" type="radio" value="thisischecked" />