Hey all,
I am just playing around with code trying to select yes or no using a radio button form. If yes show something, if no show nothing. Simple enough but I can't seem to get it to work the way I want it too.
<form method="post" action="display.php">
<input type="radio" name="display" value="show_yes">Display YES
<input type="radio" name="display" value="show_no">Display NO
<input type="submit" name="submit" value="submit">
</form>
<?php
if($_POST['show_no'])
{
echo "nothing.";
}
if($_POST['show_yes'])
{
echo "Something!";
}
?>
Obviously, it doesn't work. It only works when both name="values" are the same but it of course disables the "one radio button can only be selected" feature.
4:32am getting hard to think *walks off to make a coffee
EDIT: 4:36am
I fixed it :o
<?php
if($_POST['display'] == show_no)
{
echo "nothing.";
}
if($_POST['display'] == show_yes)
{
echo "Something!";
}
?>
*crawls back to where he came from :o