I'm doing a cart for a web configurator and I've a problem. I got this:
if (!empty($_SESSION["pedido"]) && is_array($_SESSION["pedido"])) {
echo "Ha seleccionado:";
foreach($_SESSION['pedido'] as $prod => $unidades) {
echo "$unidades unidades de $prod";
When I execute it on MAMP
, it works well, but on my server, it shows the error: Warning: Invalid argument supplied for foreach()
in [lineOfCode]. I've tried to search a solution, for example, casting the $_SESSION['pedido']
to array, and it works, until I got the $prod
key, that is not the correct (its returns a 0
instead of the product key), and I need that key
for a switch operation. Thanks.