Page 1 of 1

Checking Checkboxes

Posted: Sat Mar 27, 2004 9:49 pm
by MathewByrne
Hey,
I'm creating an online order form with a list of all products from a database. They all have checkboxes next to them:

Code: Select all

<input type="checkbox" name="item01"> Item 1
<input type="checkbox" name="item02"> Item 2
<input type="checkbox" name="item03"> Item 3
etc...
The form is posted to another page which I want to diplay all the checkboxes which are true. I know I have to loop through the items somehow, any ideas?

Posted: Sun Mar 28, 2004 1:20 am
by Bill H
Make your checkboxes an array

Code: Select all

<?php
<input type="checkbox" name="item[]"> Item 1
<input type="checkbox" name="item[]"> Item 2
<input type="checkbox" name="item[]"> Item 3

?>

Posted: Sun Mar 28, 2004 1:38 am
by m3mn0n
(This topic should have been made in the 'Client Side' forum. This doesn't relate too much to PHP Code.)