Hi everyone, new to all this so please bare with me.
I have been running some tests on PHP Ajax shopping carts and have encountered the following problem - I will deal with the simpler version for now as the 2 I am running [seem] to have the same problem:
I have the following page script running (CSS stipped here out to make it smaller):
<?php
// INCLUDE JCART BEFORE SESSION START
include 'jcart/jcart.php';
// START SESSION
session_start();
// INITIALIZE JCART AFTER SESSION START
$cart =& $_SESSION['jcart']; if(!is_object($cart)) $cart = new jcart();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>jCart - Free Ajax/PHP shopping cart</title>
<link rel="stylesheet" type="text/css" media="screen, projection" href="jcart/jcart.css" />
</head>
<body>
<div id="wrapper">
<h2>Demo Store</h2>
<div id="sidebar">
<?php $cart->display_cart($jcart);?>
</div>
<div id="content">
<form method="post" action="" class="jcart">
<fieldset>
<input type="hidden" name="my-item-id" value="1" />
<input type="hidden" name="my-item-name" value="Soccer Ball" />
<input type="hidden" name="my-item-price" value="25.00" />
<ul>
<li><strong>Soccer Ball</strong></li>
<li>Price: $25.00</li>
<li>
<label>Qty: <input type="text" name="my-item-qty" value="1" size="3" /></label>
</li>
</ul>
<input type="submit" name="my-add-button" value="add to cart" class="button" />
</fieldset>
</form>
<form method="post" action="" class="jcart">
<fieldset>
<input type="hidden" name="my-item-id" value="2" />
<input type="hidden" name="my-item-name" value="Baseball Mitt" />
<input type="hidden" name="my-item-price" value="19.50" />
<ul>
<li><strong>Baseball Mitt</strong></li>
<li>Price: $19.50</li>
<li>
<label>Qty: <input type="text" name="my-item-qty" value="1" size="3" /></label>
</li>
</ul>
<input type="submit" name="my-add-button" value="add to cart" class="button" />
</fieldset>
</form>
<form method="post" action="" class="jcart">
<fieldset>
<input type="hidden" name="my-item-id" value="3" />
<input type="hidden" name="my-item-name" value="Hockey Stick" />
<input type="hidden" name="my-item-price" value="33.25" />
<ul>
<li><strong>Hockey Stick</strong></li>
<li>Price: $33.25</li>
<li>
<label>Qty: <input type="text" name="my-item-qty" value="1" size="3" /></label>
</li>
</ul>
<input type="submit" name="my-add-button" value="add to cart" class="button" />
</fieldset>
</form>
<div class="clear"></div>
</div>
</div>
<script type="text/javascript" src="jcart/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="jcart/jcart-javascript.min.php"></script>
</body>
</html>
When this page (store.php) is run locally using MAMP on a Apple Mac i get no error messages and it seems to work fine, however, when uploaded to a windows server and load the page I get the following error messages:
Notice: Undefined index: my-item-id in E:\domains\c\client.ask-design.co.uk\user\htdocs\jcart\jcart\jcart.php on line 248
Notice: Undefined index: my-item-qty in E:\domains\c\client.ask-design.co.uk\user\htdocs\jcart\jcart\jcart.php on line 249
Notice: Undefined index: my-item-price in E:\domains\c\client.ask-design.co.uk\user\htdocs\jcart\jcart\jcart.php on line 250
On and on.....
Any ideas why this should be so anyone.
The uploaded file can be found here:
http://www.client.ask-design.co.uk/jcart/store.php
Cheers,
Regards,
Willow.