I'm trying to code a search form for an event calendar script I'm working on. I know enough php/mysql to get into trouble, but am far from being a decent coder on my own. anyhow, I was wondering if there was a better way to submit a form to do a mysql query since this seems a little sloppy to me. The form has to have multiple options from text fields, to dropdowns, to radio buttons. I'd like it to work whether you select and submit one option, or select several to better refine the search. Anyhow, this is what I have on my test form with 3 options... (each form element is a numbered searchstring).
if ($searchstring OR $searchstring2 OR $searchstring3)
{
$sql="SELECT * FROM $table WHERE $searchtype LIKE '%$searchstring%' AND $searchtype2 LIKE '%$searchstring2%' AND $searchtype3 LIKE '%$searchstring3%' ORDER BY eventname, syear, smonth, sday ASC";
Thanks in advance for any help...