Hi guys,
Please help. I keep getting the following error which I can't quite understand:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/egp9/web/cartaction.php on line 18
PHP Code:
<?
session_start();
session_register('totalPrice');
session_register('panName');
session_register('panAction');
session_register('panPrices');
session_register('cartItems');
session_register('postage');
session_register('postagex');
$_SESSION['totalPrice'] = 0;
$_SESSION['panName'] = $_POST['item'];
$_SESSION['panAction'] = $_POST['cartaction'];
$_SESSION['postage'] = 350 / 100;
$_SESSION['postagex'] = 200 / 100;
/*Check to see if both the hidden fields that hold the panName and panAction have both been posted*/
if (($_SESSION['panName']) && ($_SESSION['panAction']) && ($_SESSION['cartItems'] <= 1)) {
$_SESSION['totalPrice'] = "$_SESSION['panPrices']["$_SESSION['panName']"] * $_SESSION['cartItems'] + $_SESSION['postage']";// multiply price by quantity created as variable SESSION_cartItems
$msg = "Added to your cart: $_SESSION['panName'], value £";
} else if (($_SESSION['panName']) && ($_SESSION['panAction']) && ($_SESSION['cartItems'] > 1)); {
$_SESSION['totalPrice'] = $_SESSION['panPrices']["$_SESSION['panName']"] * $_SESSION['cartItems'] + $_SESSION['postage'] + $_SESSION['postagex'];
} else {
$msg = " Your Cart is empty";
}
// Create iamge variables to be later used to dynamically display shopping cart images
$img1 = '<IMG SRC="images/coppercasserole.jpg" ALT="copper casserole pan">';
$img2 = '<IMG SRC="images/coppersaucepan.jpg" ALT="copper sauce pan">';
$img3 = '<IMG SRC="images/coppersaute.jpg" ALT="copper saute">';
$img4 = '<IMG SRC="images/steelcasserole.jpg" ALT="steel casserole">';
$img5 = '<IMG SRC="images/steelfrying.jpg" ALT="steel frying pan">';
$img6 = ''; //Create an empty space
$c1 = 2199 / 100;
$c2 = 1988 / 100;
$c3 = 1299 / 100;
$s1 = 2099 / 100;
$s2 = 899 / 100;
$_SESSION['panPrices'] = array(
"coppercasserole" => "$c1",
"coppersaucepan" => "$c2",
"coppersaute" => "$c3",
"steelcasserole" => "$s1",
"steelfrying" =>"$s2"
);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<TITLE>Pans for your kitchen</TITLE>
</HEAD>
<BODY>
<h2><? echo $msg ?> <? print($_SESSION['panPrices']["$_SESSION['panName']"]); ?></h2>
<CENTER>
<FORM ACTION="checkout.php" METHOD="post" name="purchase_form" id="purchase_form">
<p>
<INPUT TYPE="submit" NAME="submit" VALUE="Goto Checkout">
<input type="submit" name="Submit" value="Remove">
</p>
</FORM>
<TABLE>
<TR><TD>
<? if ($_SESSION['panName'] == "coppercaserole") {
echo $img1;
} else if ($_SESSION['panName'] == "coppersaucepan") {
echo $img2;
} else if ($_SESSION['panName'] == "coppersaute") {
echo $img3;
} else if ($_SESSION['panName'] == "steelcaserole") {
echo $img4;
} else if ($_SESSION['panName'] == "steelfrying") {
echo $img5;
} else {
echo $img6; // This variable holds space
}
?>
</TD>
<TD>
<? if (($_SESSION['panName']) && ($_SESSION['panAction'])) {
echo "$panName = $_SESSION[cartItems] += 1";
} else {
echo '';
} ?><BR>
</TD>
<TD>
<FORM METHOD="post" ACTION="cartaction.php">
</FORM>
</TD>
</TR>
</TABLE>
<A HREF="index.php">Go Back Home</A>
<A HREF="copperrange.php">Copper Range</A>
<A HREF="steelrange.php">Steel Range</A>
</CENTER>
<HR>
</BODY>
</HTML>