PHP sessions with shopping cart -
i modifying simple shopping cart learn. problem session arrays. have index page product page required using require statement show.
i require cart.php
(where cart summary located). when add product first time, not show on required cart.php
. when add product, shows recent 1 in actual cart.php
, shows 2 items in cart.
does have idea going wrong? here have:
<div id="leftcolumn"> <?php require("cart.php"); ?> <div id="rightcolumn"> <?php require($page . ".php"); ?> </div>
thank you
please try read documentations first before asking questions. please try implementing first , show code you're having problems with.
example in w3schools:
<?php // start session session_start(); ?> <!doctype html> <html> <body> <?php // set session variables $_session["favcolor"] = "green"; $_session["favanimal"] = "cat"; echo "session variables set."; ?> </body> </html>