On 19-Jun-2003 vernon wrote: > > OK, I've done this. > > Problem occurs when a user selects 1 and 9. > > The SQL statement I have reads like so: > > if (isset($HTTP_GET_VARS['check00'])) { > $age00 = '00'; > $s_age00 = "penpals.agegroup = $age00 AND"; > } > > Problem is the AND statement. Some times the user will pick checkbox 1 > and 5 > but not 2,3,4,6, 7, 8, and 9. And then again there will be times when a > user > only uses one check box needing the AND statement on the end, but at > other > times the user will select more than one needing an OR statement between > the > two checkboxes. Make sense? > >
Use an array. $agesel=implode("', '", $HTTP_GET_VARS['ageselect,]); $qry="SELECT * FROM foo WHERE penpals.agegroup IN ('$agesel')"; Your HTML boxes will look like: <input TYPE=CHECKBOX NAME="ageselect[]" value="00"> <input TYPE=CHECKBOX NAME="ageselect[]" value="10"> <input TYPE=CHECKBOX NAME="ageselect[]" value="15" CHECKED> <input TYPE=CHECKBOX NAME="ageselect[]" value="20" CHECKED> <input TYPE=CHECKBOX NAME="ageselect[]" value="25"> ... Regards, -- Don Read [EMAIL PROTECTED] -- It's always darkest before the dawn. So if you are going to steal the neighbor's newspaper, that's the time to do it. (53kr33t w0rdz: sql table query) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]