I need to extract my variable names.
<form method=post action=script.php>
<input type=checkbox name=category1[] value=subcategory1>
<input type=checkbox name=category1[] value=subcategory2>
<input type=checkbox name=category2[] value=subcategory3>
<input type=checkbox name=category2[] value=subcategory4>
<submit>
</form>
In script.php, I would like to submit the category name and the subcategory name to MySQL. I would prefer not to do a bunch of if statements. I have about twenty categories. I would like to use a loop and do a SQL statement like:
"insert into category_table ("category","sub") values ($category,$category[$x]);"
I know I can extract the key() value, but I want the key name.