<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php session_start();?>
<html>
<head lang="pt-br">
<meta charset="UTF-8">
<title>E-Commerce</title>
</head>
<body>
<h1>Produtos</h1>
<ul>
<li><a href="ipad.php">Ipad</a></li>
<li><a href="playstation.php">Playstation</a></li>
<li><a href="xbox.php">Xbox</a></li>
</ul>
<br/>
<a href="carrinho.php">Ver Carrinho</a>
<?php
// put your code here
?>
</body>
</html>
Now the cart.php page:
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php session_start(); ?>
<html>
<head>
<meta charset="UTF-8">
<title>E-Commerce</title>
</head>
<body>
<h1>Carrinho de Compras</h1>
<?php
$_SESSION['valor'] = array();
array_push($_SESSION['valor'], $_GET['valor']);
?>
<?php foreach($_SESSION['valor'] as $list):?>
<ul>
<li><?php echo $list;?></li>
</ul>
<?php endforeach; ?>
<a href="produtos.php">Continuar Comprando</a>
<br/>
<br/>
<a href="#">Efetuar Pagamentos</a>
</body>
</html>
And the product page, which differs from the others only in the product name passed by the url,
!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php session_start();?>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<title>E-Commerce</title>
</head>
<body>
<h1>IPAD</h1>
<ul>
<li><a href="carrinho.php?valor=ipad">Colocar no Carrinho</li>
<li><a href="carrinho.php">Ver Carrinho</a></li>
<li><a href="produtos.php">Produtos</a></li>
</ul>
<?php
// put your code here
?>
</body>
</html>
What I'm not getting is when you leave and return to the cart keep visualizing the product, and present more products on the cart page. Thanks in advance!