0

Bit of a php and sql issue, so thought I'd try here...

for a registration form, I have created an sql file such as... firstname varchar(30) not null ...etc...for all the fields, which I then import to the database.


But then the form also has 15 checkboxes where the user may or may not check them. The checkboxes are hard coded and they all have the same name in an array, eg...

<input type="checkbox" name="nature[]" value="0" />
<input type="checkbox" name="nature[]" value="1" />
<input type="checkbox" name="nature[]" value="2" />

...etc...

The issue I am having is understanding how these values are stored in the database, since I have not created any rows in the sql file for the checkboxes. When I create the table and import it to the database, do I need to create one/some for the checkbox values???

Much help needed and appreciated, thanks!

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by skinbug
0

You could either concatenate all of the values and store them in one field or you could create three fields to store each value separately.

0

Right, yeh sussed it now thanks...I'm going to create a field for each checkbox and store the values that way and take out the array.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.