@$enq_status=$_GET['enq_status']; // Get data from query string
echo " Radio button Selected value<i> $enq_status </i><br>";
$v1=$v2=$v3=$v4=''; // checked status for different radio buttons
switch ($enq_status)
{
case 'All':
$v1='Checked';
$q= " ";
break;
case 'Live':
$v2='Checked';
$q= " WHERE enq_status='Live'";
break;
case 'Failed':
$v3='Checked';
$q= " WHERE enq_status='Failed'";
break;
case 'Matured':
$v4='Checked';
$q= " WHERE enq_status='Matured'";
break;
default:
$v1='Checked';
$q= " ";
}
echo "<div class='form-check form-check-inline'><label>
<input type='radio' name='enq_status' id='r1' value='All' $v1>All
</label></div>
<div class='form-check form-check-inline'><label>
<input type='radio' name='enq_status' id='r2' value='Live' $v2> Live
</label></div>
<div class='form-check form-check-inline'><label>
<input type='radio' name='enq_status' id='r3' value='Failed' $v3 > Failed
</label></div>
<div class='form-check form-check-inline'><label>
<input type='radio' name='enq_status' id='r4' value='Matured' $v4 > Matured
</label></div>
";
More about PHP switch <script>
$(document).ready(function() {
$("input:radio[name=enq_status]").click(function(){
my_str='enq_status='+$(this).val() // collect the value of selected radio button
window.location = "radio-button-submit.php?"+my_str; // reload / redirect the page wth value
});
/////////////
});
</script>
Radio ButtonMost Popular JQuery Scripts | |
1 | Two dependant list boxes |
2 | Calendar with Date Selection |
3 | Data change by Slider |
4 | Show & Hide element |