Jump to content

PHP radio buttons..


Ju5

Recommended Posts

I have made a form which includes text fields and radio buttons.

The user completes the fields and makes their selections. Once the form is submit, they are then directed to a php file which displays their entries and selections.

 

Atm I can't quite work out how to post their radio button selections.

 

Here is the form:

<legend>Car type</legend>

<input name="cartype" type="radio" value="1" id="carone" />

<label for="carone">Compact</label><br />

<input name="cartype" type="radio" value="2" id="cartwo" />

<label for="cartwo">Saloon</label><br />

<input name="cartype" type="radio" value="3" id="carthree" />

<label for="carthree">SUV</label>

 

and here is my current code for the text fields:

<?php

$firstname = $_POST['firstname'];

$lastname = $_POST['lastname'];

$emailaddress = $_POST['emailaddress'];

$phone = $_POST['phone'];

 

 

echo "Dear ". $firstname . " " . $lastname . ",<br />";

echo "Thank you for your order. <br />";

echo "Your contact details are:- <br />";

echo "phone: " . $phone . "<br />";

echo "email: " . $emailaddress . "<br />";

 

?>

</body></html>

 

If anyone could give a hand I'd be very grateful!

Link to comment
https://forums.phpfreaks.com/topic/237558-php-radio-buttons/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.