Jump to content

Multiple Checkbox - submitting to DB?


Solarpitch

Recommended Posts

Hi,

 

I have a list of check boxes on my page as follows...

 


        	

<input type='checkbox' name='71' value='71'>Cappuccino Oak<br>

<input type='checkbox' name='61' value='61'>Cityline Black White<br>

<input type='checkbox' name='62' value='62'>Oiled City Beige Latte<br>

<input type='checkbox' name='63' value='63'>Trendline Merbau<br>

<input type='checkbox' name='64' value='64'>Trendline Natural<br>

<input type='checkbox' name='65' value='65'>Trendline Light<br>

<input type='checkbox' name='66' value='66'>Natural Masari<br>


 

This is part of a form. What I'm trying to do is catch all the ones that the user has ticked then save the value id to a DB table. Saving it to a table and that should be fine, its just how to I get all the ones the user has ticked when the form is submitted and send them to the database?

 

So Say the last 3 were ticked, I want to write 64, 65 and 66 to the database. Just having trouble with the logic of this really.

Link to comment
https://forums.phpfreaks.com/topic/114128-multiple-checkbox-submitting-to-db/
Share on other sites

<input type='checkbox' name='checked[]' value='71'>Cappuccino Oak<br>

 

<input type='checkbox' name='checked[]' value='61'>Cityline Black White<br>

 

<input type='checkbox' name='checked[]' value='62'>Oiled City Beige Latte<br>

 

<input type='checkbox' name='checked[]' value='63'>Trendline Merbau<br>

 

<input type='checkbox' name='checked[]' value='64'>Trendline Natural<br>

 

<input type='checkbox' name='checked[]' value='65'>Trendline Light<br>

 

<input type='checkbox' name='checked[]' value='66'>Natural Masari<br>

 

$_POST['checked'] will be a multi-dimensional array with all the checked boxes' values.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.