Ju5 Posted May 26, 2011 Share Posted May 26, 2011 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! Quote Link to comment https://forums.phpfreaks.com/topic/237558-php-radio-buttons/ Share on other sites More sharing options...
xyph Posted May 26, 2011 Share Posted May 26, 2011 You didn't even attempt to echo out $_POST['cartype'] Quote Link to comment https://forums.phpfreaks.com/topic/237558-php-radio-buttons/#findComment-1220720 Share on other sites More sharing options...
Ju5 Posted May 26, 2011 Author Share Posted May 26, 2011 I'm new to PHP. Quote Link to comment https://forums.phpfreaks.com/topic/237558-php-radio-buttons/#findComment-1220722 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.