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

0 Members and 1 Guest are viewing this topic.

Offline admin

  • Administrator
  • *****
  • Posts: 43
  • Karma: +1/-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
}
?>

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
1834 Views
Last post May 09, 2008, 02:57:08 PM
by Roby
3 Replies
3320 Views
Last post January 16, 2009, 07:57:51 PM
by LauraJean