I have multiple checkboxes in my websites: checkbox 1 checkbox 2 checkbox 3 etc.
I want to dynamically generate mysql query based on the above checkboxes.
i:e if 1st checkbox is selected then the query should be:
$mysql="Select * from mytable where colname=" . $checkbox1 .;
if 1st and 2nd checkbox is selected then the query should be:
$mysql="Select * from mytable where colname=" . $checkbox1 ."AND colname=" . $checkbox2 ." ;
if all are selected then it should be :
$mysql="Select * from mytable where colname=" . $checkbox1 . "AND colname=" . $checkbox2 ."AND colname=" . $checkbox3 . ;
Can someone pls help: