Author Topic: Check if a radio button has been checked  (Read 1104 times)

0 Members and 2 Guests are viewing this topic.

Offline admin

  • Administrator
  • *****
  • Posts: 57
  • Karma: +2/-0
  • Gender: Male
Check if a radio button has been checked
« on: January 26, 2010, 01:04:47 AM »
Code: [Select]
<?php
if(isset($_POST['submit']))
{
$fradio $_POST['fradio'];
if (
strlen($fradio) == 0) {
echo 
"<center>FALSE:<a href=\"javascript:history.go(-1)\">Go Back</a></center>";  
 Die();
}else{
echo 
"<center>TRUE:<a href=\"javascript:history.go(-1)\">Go Back</a></center>";
}  
}else{
?>

<form method="post" action="check.php">
<input type="radio" name="fradio" value="1">1
<input type="radio" name="fradio" value="2">2
<input type="submit" name="submit" value="submit">
</form>
<?php
}
?>