i have a table data of shop product list
id | product name | shop Name
----------------------------
1 | Suger | Ram Store
-----------------------------
2 | Oil | Suraj Store
-------------------------------
3 | Batter | Ram Store
------------------------------
4 | Maida | Ram Store
--------------------------------
5 | Rice | Ram Store
--------------------------------
6 | Suger | Suraj Store
--------------------------------
7 | Oil | Ram Store
--------------------------------
8 | Rice | Suraj Store
now user search multiple value :
search.php
<form method="post" action="results.php">
<select name="product[]" multiple>
<?php $showp=$db->query("SELECT * FROM product ORDER BY productname ASC");
$showte = $showp->fetchAll();
foreach($showte as $runshow){
$productname=$runshow['productname'];
$productid=$runshow['id']; ?>
<option value="<?php echo $productname; ?>"><?php echo $productname; ?></option>
<?php } ?>
</select>
<input type="submit" name="submit" value="Search"/>
</form>
now is result.php
if(isset($_POST['submit'])){
foreach($_POST['product'] as $productselect){
echo $productselect."<br>";
$query = $db->query("SELECT * FROM product WHERE testid LIKE '$productselect' ");
$new = $query->fetchAll();
if(count($new)){
foreach($new as $show){
echo $show['shopname'];
echo "productname = ".$show['productname']."<br/>"; }
}
else{ echo "No Result Found<br/>"; }
}
}/* serech if isset close */
now select user is suger , oil , batter
user result show is : --
suger
suraj store
ram store
oil
suraj store
ram store
batter
ram store
result show is ok but i want show in shop list like
suraj store
suger
oil
ram store
suger
oil
batter
please say how i do this ..
thanks in advance for your support