Hi,
when I click on a link ("Add to cart"), I go to a file where I check if the item clicked was the first item to be added to the cart; If so, I would redirect the user to a "information form".
In the items for sale page, for one of the items, I have:
session_start();
....
<a href="../../shopping/add_cart.php?id=4171&builder=1>Add to cart</a>
Then, in add_cart.php:
session_start();
if (isset($_GET['id']))
@ $id = $_GET['id'];
if (isset($_GET['builder']))
@ $builder = $_GET['builder'];
echo 'some debugging line of code';
// if the first item is being added to cart
if (!isset($_SESSION['builder'])) {
$_SESSION['builder'] = $builder;
header("Location: info_form.php?builder=$builder"); // redirect to information form
}
Here, I get the following warning on the page, after clicking on the "Add to cart" for the first time:
Warning: Cannot modify header information - headers already sent by (output started at /home3/www/mydomain/shopping/add_cart.php:11) in /home3/www/mydomain/shopping/add_cart.php on line 15
where line 15 is the "header" statement.
On the page that list the items for sale, I also have a session_start() on the top.
Thanks a lot.