I researched a lot and found some solution ,probably not a convincing solution for me.Hence i am posting this question,Please help me
I Have A checkbox with same name and different values like
1.cate.php
<form action="mobile-phones-category.php" method="post">
<input type="checkbox" value="samsung" name="mobile[]"> sams
<input type="checkbox" value="nokia" name="mobile[]"> nolkia
<input type="submit" name="submit" value="SUBMIT" class="btn btn-primary pull-right">
</form>
2.) mobile-phones-category.php
I retrieve the values of check box on submit[array format] and want to search from db..I am using normal mysql_query(not pdos)
$search=$_POST["mobile"];
$search_string = implode(', ', $search);
echo $search_string
;
Here i Get something like Nokia,Sams
Next I write a single sql query
include('connection.php');
$query = mysql_query("SELECT * FROM tablename where titles like '%$search_string%' ") or die(mysql_error());
What is happening is that only one value in the array is searched and not all the values in array..What changes should i Make so that all the array element should get searched
Thanks and regards