0
$id= $_POST['id'];
if(!isset($_SESSION['itens'])){
$_SESSION['itens'] = array();
}
if(isset($_POST['id'])){
$id= $_POST['id'];
if(!isset($_SESSION['itens'][$id])){
$_SESSION['itens'][$id] = 1;
}else{
$_SESSION['itens'][$id] += 1;
}
}
$consulta = "SELECT * FROM informaoces WHERE id='$id'";
$con = mysqli_query($mysqli,$consulta);
?>
Product name
price
amount
What’s wrong with this code, When I add other products to the cart, they don’t get added in the same table, now if you keep adding the same products more than once, increases the amount, now if you add another different product; it doesn’t go to the same table
I don’t understand. you want to get product information through a request ? What is the purpose of $_POST since the items are in $_SESSIONS ?
– Atila Silva
Is not missing
session_start();
not in that code?– user60252
your code does this http://kithomepage.com/sos/carrinho.php creates an array with the keys being the ids and the values adding +1 to the value of the key already created. Care that is also creating if send null field
– user60252
The session_start() has
– Davi
Atila silva this POST method is to send the id from one page to another
– Davi