Hi All,
I hate to ask such a lame question, but all the searches I did on "in_array" aren't working for me. What I want to do is simple:
I have a form that allows people to sign up for a conference time. There are multiple radio buttons. Once a timeslot is picked, a red "X" will appear instead of a radio button to show that slot is taken. I thought this would work, but I'm only getting the last time in my array.
-------------- PHP------------
$select = "SELECT selTime FROM conferences WHERE iid=$iID";
$res = mysql_query($select);
$num = mysql_num_rows($res);
while ($myrow = mysql_fetch_row($res)) {
$selT = explode(",",$myrow[0]);
}
-------------- PHP ------------
<form>
[chunk taken out]
<td>
<?
if($num > 0){ if(in_array("0700", $selT)){ echo <b>X</b>"; }else{ echo "<input type=radio name=selTime value='0700'>";}}
?>
</td>
<td>
<?
if($num > 0){ if(in_array("1200", $selT)){ echo <b>X</b>"; }else{ echo "<input type=radio name=selTime value='1200'>";}}
?>
</td>
</form>
When I echo out $num I get 2, which is correct. 0700 and 1200 are taken, but I only get the "X" on 1200. Why isn't 0700 in my array? Should I use IMPLODE instead? Perhaps there is a much simpler way of doing this...
Thanks for any assistance 🙂
Geogal