Choice with radio buttons.
TAGS: radio, radiobuttons, choice, PHP


Here is shown two radio buttons and one submit button.
At submit the PHP code will check if one or the other was chosen, and then send your user to a page depending on the choice.

Put this in a PHP page:

<?PHP 
if ($_POST['page'] == "webdev") { 
header('location:http://dev.webpages.dk/'); 
} elseif ($_POST["page"] == "food") { 
header('location:http://food.webpages.dk/'); 
} 
?>

<HTML><BODY> 
<FORM METHOD='POST' ACTION=''> 
<INPUT TYPE='radio' NAME='page' VALUE='webdev'> webdev<BR /> 
<INPUT TYPE='radio' NAME='page' VALUE='food'> food<BR /> 
<INPUT TYPE='submit'><BR /> 
</FORM> 
</BODY></HTML>


Call the page in your browser. You should see the radio buttons and the submit button. Make a choice and click on the submit. You are now sent either to the Web Dev frontpage, or the frontpage of the Food site.