Hello,
From this code below i get this error Parse error: parse error, unexpected $ in /usr/local/psa/home/vhosts/eukhost.com/httpdocs/shop/cart.php on line 124 I have checked and checked yet found no mistakes can any body please help
Code:
<?php
require 'site_lib.inc';
session_register('cart');
if (!isset($cart[num_items])) {
$cart = array("num_items" => 0,
"products" => array());
}
LoadProducts();
?>
<html>
<head>
</head>
<body>
<h1>Welcome</h1>
<?php
if ($cart[num_items]) {
?>
Number of items currently in shopping cart.
<table border=0 cellpadding=5 cellspacing=1>
<tr>
<th>
Product Name
</th>
<th>
Short Description
</th>
<th>
Price
</th>
<th>
Quantity
</th>
<th>
 
</th>
</tr>
<?php
foreach ($cart[products] as $i => $products) {
$product_id = $product[0];
$quantity = $product[1];
$total += $quantity *
(double)$master_products_list[$product_id][price];
?>
<tr>
<td>
<?php echo $master_products_list[$product_id][name]; ?>
</td>
<td>
<?php echo $master_products_list[$product_id][desc]; ?>
</td>
<td>
<?php echo $master_products_list[$product_id][price]; ?>
</td>
<td>
<form action="change_quant.php" method=GET>
<input type=hidden name=id value="<?php echo $i; ?>">
<input type=text size=3 name=quantity value="<?php echo $quantity; ?>">
</td>
<td>
<input type=submit value="Update Quantity">
</td>
</tr>
<?php
}
?>
<tr>
<td>
£<?php echo $total; ?>
</td>
</tr>
</table>
<br><br>
<h1>We offer the following products</h1>
<table border=0 cellpadding=5 cellspacing=1>
<tr>
<th>
Product Name
</th>
<th>
Product Description
</th>
<th>
Price
</th>
<th>
 
</th>
</tr>
<?php
foreach ($master_products_list as $product_id => $item) {
?>
<tr>
<td>
<?php echo $item[name]; ?>
</td>
<td>
<?php echo $item[desc]; ?>
</td>
<td>
£<?php echo $item[price]; ?>
</td>
<td>
<a href="add_item.php?id=<?php echo $product_id; ?>">
Add This Item To Your Shopping Cart
</a>
</td>
</tr>
<?php
}
?>
</table>
</body>
</html> // line 124
Any suggestions please?