I have an html form that should, and does, return an array for some checkboxes. However, when I use the "in_array" function for the values, it always returns false. I'm sure I'm missing something simple - any ideas?
HTML Code:
[FONT=courier new]<input name="employment[]" type="checkbox" id="employment" value="Full-time">Full-time <br>
<input name="employment[]" type="checkbox" id="employment" value="Part-Time">Part-time <br>
<input name="employment[]" type="checkbox" id="employment" value="Seasonal">Seasonal[/FONT]
The following code
while (list($key, $val) = each($HTTP_POST_VARS['employment'])) {
$line="$key => $val\n";debug($line);
}
correctly prints
0 => Full-time
1 => Seasonal
while
if(in_array($HTTP_POST_VARS['employment'],"Seasonal")) {
$line="true";debug($line);
} else {
$line="false";debug($line);
}
prints
false
Thanks,
Sarah