Reputation: 251
I have two radiobutton, "A" and "B". When I checked the "A", then click the submit button after it load the "A" is already checked in the next form. Same also in "B". How can I code the radiobutton to remain checked when the user checked the radiobutton.
Here's my code where I want to insert the checked radiobutton.
$radio = mysql_query("SELECT fldNetname FROM tbldata WHERE fldWeek = '$get_week' GROUP BY fldNetname ORDER BY fldNetname");
while ($row = mysql_fetch_array($radio))
{
echo "<div><input type='radio' name='playRadio[]' class='chk_boxes1' value='" . $row['fldNetname'] . "'>";
echo $row['fldNetname'];"</div>";
}
*NOTE:
All I want is to remain the radio button checked...
Upvotes: 0
Views: 3183
Reputation: 810
echo "<div><input type='radio' name='playRadio[]' class='chk_boxes1' value='" . $row['fldNetname']."' .<?php if ($_POST['playRadio[]'] == $row['fldNetname']) echo 'checked';. >";
Upvotes: 2