ee12csvt wrote:I already tried that hoping that it would work. It has no effect.
It's still the right thing to do.
<td align="center"><? $ID[]=$rows['ID_Number']; ?><? echo $rows['ID_Number']; ?></td>
<td align="center"><? $First_Name[]=$rows['First_Name']; ?><? echo $rows['First_Name']; ?></td>
<td align="center"><? $Last_Name[]=$rows['Last_Name']; ?><? echo $rows['Last_Name']; ?></td>
<td align="center"><? $Sept_08_2008[]=$rows['Sept_08_2008']; ?><?
echo("Yes: <input type='radio' name='Sept_08_2008' value='Y'");
if($Sept_08_2008 == Y) {
echo(" checked>");
} else {
echo(">");
}
echo("No: <input type='radio' name='Sept_08_2008' value='N'");
if($Sept_08_2008 == N) {
echo(" checked>");
} else {
echo(">");
}
?> </td>
The problem is those [] bits; they make $ID, $First_Name, and all the rest arrays of values (by the time you get to the end of the list, $ID will be containing all of the IDs in the list).
You're not using almost all of them, so you might as well drop the <? $ID[]=$rows['ID_Number']; ?> bits completely (and while I'm looking at that, I recommend you stick to using "<?php" and don't get into the habit of using "<?" ... Long story.).
The only exception is $Sept_08_2008[]. Like I said, you're making $Sept_08_2008 an array. And an array is never equal to "Y" (or "N" for that matter), the radio buttons never get checked (and the modern standard is to use checked="checked", not just checked).
So put <?php $Sept_08_2008 = $rows['Sept_08_2008'] ?> instead of what you have now, and see how it goes.
Now all of your radio buttons have the exact same name, which means you'll only be able to select one of them. I'm guessing that's not what you want, and what you want is for each row of radio buttons to work separately from the other rows. (If it is what you want you can stop reading.) They'll have to have different names. The cleanest way to do that will be to bring back $ID (not $ID[]!) and name the radio buttons as
echo("Yes: <input type='radio' name='Sept_08_2008[".$ID."]' value='Y'");
When you process the form, $POST['Sept_08_2008'] will have an array of all the radio buttons, with, for example $POST['Sept_08_2008'][3] having the value "Y" if row 3's "Y" button was selected.
Y'know, if there are only two choices then one checkbox would do the job better than two radio buttons....