View Full Version : Simple Radio Button Script Help Please
mattyp747
Jan 13th 2008, 5:44 am
hi im looking for a script so that when a radio button is selected and you click on the submit button it will take you to the page relevant to what you chose, eg: (0) = radio button!
(0) option 1
(0) option 2
submit button
if you checked option 1 and clicked submit would take you to say 1.html and if you clicked option 2 would take you to say 2.html.
you can only have one button selected at one time.
please help, i know this is simple but cannot work it out, sorry.
Bohol
Jan 13th 2008, 7:16 am
Check dynamicdrive.com there are lots of scripts there.
mattyp747
Jan 13th 2008, 7:30 am
Check dynamicdrive.com there are lots of scripts there.
i had already checked there and cant find anything that helps. :eek:
can you give me a direct link?
guestonline
Jan 13th 2008, 7:34 am
u need the html code???
mattyp747
Jan 13th 2008, 7:36 am
u need the html code???
yup please. :)
guestonline
Jan 13th 2008, 8:15 am
i can help with the php code
mattyp747
Jan 13th 2008, 8:26 am
php,html either and or!
can someone post the code please!!!!!
cheers.
guestonline
Jan 13th 2008, 8:59 am
<html>
<head>
<title>My Page</title>
</head>
<body>
<form name="myform" action="temp1.php" method="POST">
<div align="center"><br>
<input type="radio" name="group1" value="Milk"> Milk<br>
<input type="radio" name="group1" value="Butter" checked> Butter<br>
<input type="radio" name="group1" value="Cheese"> Cheese
</div>
</form>
</body>
</html>
it will get redirected to next page temp1.php..in this write php code follows
<?php
if($_POST['group1']=='Milk')
header("Location : your page1);
else
header("Location : your page2);
?>
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.