Member Avatar

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" />


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!

Recommended Answers

All 2 Replies

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.

Member Avatar

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.