I have 20 checkboxes on a form on my website, I need to select between 1-3. but u can have say
1, 2 and 3 or 4, 5 and 1
once the user has selected which checkboxes he wants it search the database for the appropriate answer based on what they have selected.
my thought was to have 'IF' statements but that mean i would have loads.
Any other way around it?
if ((!empty($1)))
{
$sql= "SELECT * FROM db WHERE db.category
LIKE CONVERT( _utf8 '%1%' USING latin1 ) COLLATE latin1_swedish_ci $limit ";
$result = mysql_query($sql);
}
else if ((!empty($1)) && (!empty($2))) {
$sql= "SELECT * FROM db WHERE db.category
LIKE CONVERT( _utf8 '%1%' USING latin1 ) COLLATE latin1_swedish_ci
AND db.category LIKE CONVERT( _utf8 '%2%' USING latin1 )
COLLATE latin1_swedish_ci $limit "; $result = mysql_query($sql);
}