I have two set of radio buttons in html form button and button1. I am using below code to
1.keep the default value checked (
I had a similar problem recently, but had a lot more radio buttons to deal with, so I thought I'd abstract away the value checking functionality into a method that also creates the radio button itself, therefore minimising repetitive value-checking code. I've reworked mine to suit your variable names:
function createRadioOption($name, $value, $onClickMethodName, $labelText) {
$checked = '';
if ((isset($_POST[$name]) && $_POST[$name] == $value)) {
$checked = ' checked="checked"';
}
echo('');
}