I am submitting the form and getting the url like http://localhost/web/test.php?cuisine=1&cuisine=2&cuisine=3
.
I want to get the result like echo $_GET['cuisine'];
and the output should be "1,2,3" / $rt = "1,2,3";
i want to use it in query (select * from table where id in ($rt) )
My Form: No Cuisine Restriction
$result = $db->query("
SELECT
*
FROM
cuisines
WHERE
status=1
order by id
");
while($rs = $result->fetch_array(MYSQLI_ASSOC)) {
?>
<option value="<?php echo $rs["id"]; ?>"><?php echo $rs["ename"]; ?></option>
<?php } ?>
</select>
</form>
I have tried the below but it is taking only the last id#3, when i select only the one not multiple it works fine:
$temp = $_GET['cuisine'];
$thelist = implode(",",$temp);
I have tried http://localhost/web/test.php?id[]=1&id[]=2&id[]=3
& printing the result it gives me this Array ( [0] => 1 [1] => 2 )
but how to use it in WHERE id IN (....);
i tried bu can not.