This list has helped me out alot and I hope it can do it one more time.
I need to build a MySQL query based on 11 different options from a form. Some options will have values others will be checkboxes to say include in the query.
In addition to the other suggestions, if you're going to have a series of checkboxes (or any field) that's going to be matched against the same column in your database, you can use a little trick by making your form element an array.
<input type="garage[]" value="2 car">2 Car <input type="garage[]" value="1 car">1 Car <input type="garage[]" value="None">None
Then you can use this bit of PHP code to add the criteria to your query...
<?php
$list = "'" . implode("','",$_POST['garage']) . "'"; $criteria = " AND garage IN ($list)";
Just add $criteria to your query, now.
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php