regarding with the shopping cart..
uhm i have this code that would insert a statement in the sql server..when you click the buy button now the problem is this error..
Parse error: parse error, unexpected $end in C:\Program Files\xampp\htdocs\xampp\GPS_Php4\checkout.php on line 106
i don't really know how to fix it and i check the closing tags of php and html . and i think i also have some errors regarding the insert statement..
please help me thank you so much in advance
well here's the code
<?PHP
session_start();
$fname=$_SESSION['user'];
/*if(!(isset($_SESSION['valid'])))
{
header('Location:login.php');
exit();
}*/
require 'list.php';
if(@$_POST['submit']=='clear cart')
{
unset($_SESSION['cart']);
}
elseif(isset($_POST['update']))
{
foreach(@$_POST['update'] as $id=>$p)
{
if(preg_match('/[0-9]/',$p))
{
if($p=='0')
{
unset($_SESSION['cart'][$id]);
}
else
{
$_SESSION['cart'][$id]=$p;
}
}
}
}
?>
<?php
require("connection.php");
if(isset($_POST['buy']))
{
if($insert = 1)
{
$cid=$_POST['cart_id'];
$id=$_POST['prod_id'];
$name=$_POST['prod_name'];
$price=$_POST['prod_price'];
$qty=$_POST['quantity'];
//$total=$_POST['total'];
$sql= "INSERT INTO cart_order VALUES ('".$cid."','".$id."','".$name."',".$price.",".$qty.")";
mysql_query($sql);
$resultInsert = $connection ->query($sql);
echo "Record save sucessfully";
require("pay.php");
?>
<html>
<form action="<?=$_SERVER['PHP_SELF'] ?>" method="post">
<table border=1>
<tr>
<td>ITEMS</td>
<td>Name</td><td>Price</td>
<td>Amount</td>
</tr>
<?php
$counter=0;
if(@is_array($_SESSION['cart']))
{
foreach(@$_SESSION['cart'] as $id=>$count)
{
$counter++;
echo "<tr><td>{$counter}</td><td>{$product[$id]['desc']}</td><td>{$product[$id]['price']}</td><td><input type=\"text\" name=\"update[{$id}]\" value=\"{$count}\"></td></tr>";
$total_value+=$product[$id]['price']*$count;
}
}
?>
<tr><td colspan=3>Total </td><td><?=$total_value ?></td></tr>
<tr>
<td><input type="button" name="continue" value="continue shopping" onclick="javascript:window.location.href='new_arrival.php' "</td>
<td><input type="submit" name="submit" value="clear cart" ></td>
<td><input type="submit" name="submit" value="update"></td>
<td><input type="button" name="buy" value="buy" onclick="javascript:window.location.href='pay.php' "></td>
</tr>
</table>
</form>
</body>
</html>
please please i relly need help :'(