RE: [PHP-DB] multiple checkbox selection for search form

2003-02-19 Thread John W. Holmes
> I need some assistance here...
> I am toying with a search form that will allow the user to select 3
> options from a set of checkboxes to search by (eg.)
> 
> [[ Select any 3 type ]]
> 
> [ ] option1   [ ] option2   [ ] option3
> [ ] option4   [ ] option5   [ ] option6
> [ ] option7   [ ] option8   [ ] option9
> 
> what I would like to do is to allow then to select only 3 options
> then search the database for the 3 options selected.

Name all of your checkboxes the same, with an [] on it. 

 Option1
 Option2
etc...

Then, you'll have a $_POST['option'] array (or $_GET) when your form is
submitted. 

if(isset($_POST['option']) && count($_POST['option']) <= 3)
{ //perform your search }
else
{ echo "You must select between 1 and 3 options."; }

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP-DB] multiple checkbox selection for search form

2003-02-18 Thread Earl Clare
hey guys,

I need some assistance here...
I am toying with a search form that will allow the user to select 3 options from a set 
of checkboxes to search by (eg.)

[[ Select any 3 type ]]

[ ] option1   [ ] option2   [ ] option3
[ ] option4   [ ] option5   [ ] option6
[ ] option7   [ ] option8   [ ] option9

what I would like to do is to allow then to select only 3 options
then search the database for the 3 options selected.

thanks in advance.