I am sending a variable with multiple values like this:
JQUERY:
$(".indexMain").load('indexMain.php?color=' + colors.join("+"), function()
--> indexMain.php?colors=blue+red+brown
I want to _GET those values and then use them in a while loop to put them into a SQL query like this one:
$items = $con -> prepare("SELECT * FROM item_descr WHERE color_base1 = :colorbase1");
$items -> bindValue(":colorbase1", $color);
Thanks!
EDIT: here is my current code but it is not working, it just shows the items corresponding to the 1st color.
foreach (explode(' ', $_GET['color']) as $color)
{
$items = $con -> prepare("SELECT * FROM item_descr WHERE color_base1 = :colorbase1");
$items -> bindValue(":colorbase1", $color);
}
var_dump(explode(' ', $_GET['color']));output?