Hi,
I want to get access to multiple checkboxes using PHP, I have found this solution:
<input type="checkbox" name="myvar[]" value="123"> 123
<input type="checkbox" name="myvar[]" value="abc"> abc
<input type="checkbox" name="myvar[]" value="456"> 456
which works fine, the problem is after using [] in the name attribute, i can no longer apply a "select all" function using javascript.
any ideas??
** checkboxes need to have the same name for they're going to be used as an array in PHP to handle MYSQL queries.
SOLVED:
managed to work it out by using getElementsByName('myvar[]') in the "select all" function; allowing me to maintain a single name for all the checkboxes.
Thank you.
I want to get access to multiple checkboxes using PHP, I have found this solution:
<input type="checkbox" name="myvar[]" value="123"> 123
<input type="checkbox" name="myvar[]" value="abc"> abc
<input type="checkbox" name="myvar[]" value="456"> 456
which works fine, the problem is after using [] in the name attribute, i can no longer apply a "select all" function using javascript.
any ideas??
** checkboxes need to have the same name for they're going to be used as an array in PHP to handle MYSQL queries.
SOLVED:
managed to work it out by using getElementsByName('myvar[]') in the "select all" function; allowing me to maintain a single name for all the checkboxes.
Thank you.