I have 42 checkboxes in my form as im programming a page where the user is choosing their interests.
By naming all the checkboxes “interest”, is there any way of making an array of values?
Example:
<input type="checkbox" name="interest" value="34" />
<input type="checkbox" name="interest" value="19" />
//values in array
$interestArray[0] = 34;
$interestArray[1] = 19;
You’re looking for this?
Specifying an arrays key is optional in HTML. If you do not specify the keys, the array gets filled in the order the elements appear in the form.
From PHP manual: How do I create arrays in a HTML ?