Hi
is it possible to read the values of a array of checkboxes submitted in a form?
the number of checkboxes generated is variable, and it's values as well. So i need to implement a script to read the array values as part of the the $HTTP_POST_VARS is if possible? but how?
reading checkbox array
Moderator: General Moderators
You have to know the names of the checkboxes, because there is not a way yo tell if the value is from a checkbox or any other control. Try something like this.
Note! I don't really remember the syntax of sscanf. But it think this would work.
Code: Select all
foreach($_POST as $key => $val){
if(sscanf($key, "checkboxnr%d", $nbr){
echo "Checkbox number $nbr hade the followinf value, $val";
}
}I tried to explain it here: viewtopic.php?t=4396