I have a form with checkbox based on which I want to made a search in sql table.
<input name="pc[]" type="checkbox" value="1">I      
<input name="pc[]" type="checkbox" value="2">II      
<input name="pc[]" type="checkbox" value="3">III
If checkbox 1 is ticked then the query should be like this
$result=$mysql_query="SELECT * FROM students1 WHERE PartCode IN ('1') ";
If checkbox 1 and 2 are ticked then the query should be like this
$result=$mysql_query="SELECT * FROM students1 WHERE PartCode IN ('1', '2') ";
etc.
For that purpose I wrote the following code. But its not working.
$ad = implode ("','",$_POST['pc']);
$result=mysql_query("SELECT * FROM students1 WHERE PartCode IN ('$ad') ");
how to edit the code?