PHP and sessions?

martinatkinson

Registered
Hey all,

I am having some trouble with a site I am putting together with PHP. I am trying to make a shopping cart system using sessions. If you go to the following URL:

http://www.amazingyardsale.com/checkout.php?id=2&price=5&basket=Radio

It should add an item to your basket, a radio with a price of $5. However, it is always telling me my basket is empty.

I need some help with this, I have attached the PHP source code for this document (checkout.php) Any help would be much appreciated!

Albert
 

Attachments

  • checkout.txt
    10.2 KB · Views: 7
instead of :

<?php
session_start();

global $id;
global $price;
global $basket;
?>

Try this :

<?php
session_start();
session_register("id","price","basket");
$id;
$price;
$basket;
?>

remember to begin all the rest of the pages with session_start()
 
Back
Top