Wednesday, 18 September 2013

radio button is not working

radio button is not working

<form method="POST"/>
FATHER<input type="radio" name="r" value="father">
MOTHER<input type="radio" name="r" value="mother ">
KID<input type="radio" name="r" value="kid ">
<input type="submit" name="submit" value="Submit">
</form>
<?php
if (isset($_POST['submit']) && $_POST['submit']=='Submit') {
if(!empty($_POST['r']) || !empty($_POST['r']))
{
$h=$_POST['r'];
}else {
$h='';
}
if($h =="father" )
{
echo "1";
} else if($h =="mother" ) {
echo "2";
} else if($h =="kid" ) {
echo "3";
}
}
I have 3 radio button id kid , father and mother , when the user clicked
on any of the radio button , i have assigned some value for father ,
mother and kid . When i clicked on the father , its showing me the result
but when i click on the mother and kid button , it showing me nothing .
Please can anybody help me .

No comments:

Post a Comment