PHP: Radiobutton with checked not working

I have a radiobutton but then its not working when I click the submit button.. The submit button will just reload again the page of "weeks_process.php" [same page] but then the checked comman in may code is not working..

Here's my code below:

$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']."' " .($_POST['playRadio[]'] == $row['fldNetname'] ? 'checked' : '') . " >";

echo $row['fldNetname'];"</div>";
}

thanks

Upvotes: 0

Views: 667

Answers (1)

Palantir
Palantir

Reputation: 24182

The name of your radios must not be an array: you need to use the same name for all the radios, and you will get a single value in PHP holding the value the user selected.

Upvotes: 2

Related Questions