how to store a checkbox result into sql ?
Posted: Tue Jun 16, 2009 10:33 pm
Hello there,
I'm new to this forum, so sorry in advance, if I do something wrong.
I've got a checklist on my page, which user can check and submit:
When they submit, I can get the data into the array:
This defines into which categories a food belongs to.
So how do I store this definition into an sql database with the article name?
For example when user wants to store a "milk", which they select it belongs
to drinks and cold drinks, then $categories contains array of [0] => drinks [1] => cold drinks
So what query, please, should I send, to store the categories definition?
Thanks in advance!
RiMMER
I'm new to this forum, so sorry in advance, if I do something wrong.
I've got a checklist on my page, which user can check and submit:
Code: Select all
<input type="checkbox" name="checkbox[]" value="foods" />
<input type="checkbox" name="checkbox[]" value="drinks" />
<input type="checkbox" name="checkbox[]" value="cold drinks" />Code: Select all
$categories = $_POST['checkbox'];So how do I store this definition into an sql database with the article name?
For example when user wants to store a "milk", which they select it belongs
to drinks and cold drinks, then $categories contains array of [0] => drinks [1] => cold drinks
So what query, please, should I send, to store the categories definition?
Thanks in advance!
RiMMER