View Full Version : Php form submit radio group

11-19-2012, 12:36 PM
Hi guys,

I'm new to this and also inexperienced so please excuse my mistakes.

I have set up a website and from the HTML end of things all is well. I have however a feedback page where I have a form with a few data variables. I think I have the php set up ok except for the radio group. I have no clue how to set up the code for the radio group please see images below.

HTML for radio group...

Here are my current data variables and I want to add below the radio group code...

If some one could please help me with this I would be extremely grateful.. This has been driving me nuts.


11-20-2012, 08:43 AM
$radio =$_POST['foodquality'];

and in your email add echo $radio;

11-20-2012, 09:40 PM
Hi edbr,

Thank you for taking the time to help me... I have added in your code but I am unsure of the echo bit. Below is the code I currently have.. I got this from various YouTube tutorials etc. so I really am a small fish in a big pond!.

I am thinking of entering in a second radio group i am assuming i do the following...

$radio =$_POST['name of new group'];

put this below..
New Label: $name of new group <br>

am i on the right track or completely lost? I really appreciate your help so far.



/*Subject and Email Variables*/

$emailSubject = 'Feedback';
$webMaster = 'my email address';

/*Data Variables*/

$name = $_POST['name'];
$email = $_POST['email'];
$contacttel = $_POST['contacttel'];
$dateoforder = $_POST['dateoforder'];
$time = $_POST['time'];
$avgtime = $_POST['avgtime'];
$shopselect = $_POST['shopselect'];
$radio =$_POST['foodquality']; <---------- YOUR Code

$body = <<<EOD
Name: $name <br>
Email: $email <br>
Contact Tel: $contacttel <br>
Date Of Order: $dateoforder <br>
Time: $time <br>
Average Wait Time: $avgtime <br>
Shop: $shopselect <br>
Food Quality: $foodquality <br> <--------------- Is this Correct?

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster,$emailSubject,$body,$headers);

/*Results rendered as HTML*/

$theResults = <<<EOD
<title>sent message</title>
<meta http-equiv="refresh" content="3";URL=http://my url">
<style type="text/css">
font-family: sans-serif, Veranda, Aerial, Helvetica;
font-size: 20px
font-style: normal;
line-height: normal;
color: #696969
text-decoration: none;
padding-top: 300px;
margin-left: 400px;
width: 450px;
<div align="center">Your message has been sent, thank you.</div>
echo "$theResults";

11-21-2012, 02:32 AM
this is the section that will be sent to you and should contain the variables you have named $body = <<<EOD
Name: $name <br>
Email: $email <br>
Contact Tel: $contacttel <br>
Date Of Order: $dateoforder <br>
Time: $time <br>
Average Wait Time: $avgtime <br>
Shop: $shopselect <br>
Food Quality: $foodquality <br> <--------------- Is this Correct?

so last lline

Food Quality: $foodquality <br>

should be

Food Quality: $radio <br>

or change variable to $foodquality =$_POST['foodquality'];

11-21-2012, 07:44 PM
I will put the variable as this:

$foodquality =$_POST['foodquality'];

then the leave the data to be sent as this

Food Quality: $foodquality <br>

Hopefully I get it working. I'm due to upload to host on Monday. I will let you know if it all runs smoothly.

Really appreciate your help.