Have You Seen Websiste That Have Multiple Checkboxes In Their Forms And Select Which Choices You Want And To Ignore The Rest [2324], Last Updated: Mon Jun 24, 2024
Webune Support
Tue Feb 16, 2010
1 Comments
535 Visits
today i had a challenge which i had never done before.
have you seen websiste that have multiple checkboxes in their forms and select which choices you want and to ignore the rest
for example, lets say i have a form that looks like this:
please choose your favorite color:
Red
Blue
Green
Yellow
Orange
Black
as you can see from my form, you can choose which colors you like and i want to have a mysql query where only the boxes that are checked i want to update and ignore that ones that are not checked.
its easy, you have to give the name of the input to an array, for example like this:
<input type="checkbox" name="colors[]" value="1"> Red
so this will create an array and all i have to do is update the ones that have values in the array. so my array would look like if i select Red and Blue only:
OUTPUT
[colors] => Array
(
[0] => Red
[1] => Blue
)
once you have submited you can use a loop to put it all together:
https://www.webune.com/forums/update-multiple-one-query.html