[UPHPU] Checkboxes and MySQL

Ken Snyder ksnyder at coremr.com
Tue Nov 28 11:51:27 MST 2006


Wade Preston Shearer wrote:
> Checkboxes can only have one of two values: TRUE or FALSE
>
> What you want is this:
>
> <input type="checkbox" name="vintage" value="" />Vintage<br />

I'm sure that with PHP you can do as Nick writes

<input type="checkbox" name="test[]" value="vintage" />Vintage<br />
<input type="checkbox" name="test[]" value="comedy" />Comedy<br />
<input type="checkbox" name="test[]" value="family" />Family<br />

And when vintage and comedy are checked $_REQUEST['test'] equals 
array('vintage','comedy');

This format is useful when you want to store data in an association-type 
table, i.e.

users_genres
user_id | genre_id
1 | 10
1 | 11
etc.


More information about the UPHPU mailing list