Hello,
I have this code and im trying to make a simple shopping cart.
I have check to see if a user has been logged in. If they are not, it prompts them to log in.
If they are logged it, it shoudl work fine.
Here is my code:
<?php
include ('common.php');
?>
<html>
<style type="text/css">
<!--
.style1 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #3366CC;
}
</style>
<p><span class="style1">
</html>
<?php
if($_SESSION['login'] == 1) {
switch($_REQUEST['req']){
case "add_to_cart":
if((!$_GET['mediaid'])||(!$_GET['userid'])){
echo "Url invalid! PLEASE PRESS BACK ON THE BROWSER OR LOGIN";
exit();
}
//script to add item to cart
break;
case "remove_from_cart":
//script to remove from cart
include ('shoppingCart.php');
break;
default:
//the shopping cart front end
break;
}
}else {
echo '<p><br>YOU ARE NOT LOGGED IN</p>';
include ('userlogin.htm');
}
?>
The error i am gettin is very strange cos it keeps pointong to line 27, no matter how many spaces i put in the code.
Parse error: parse error, unexpected '{' in C:\Program Files\Apache Group\Apache2\htdocs\shoppingCart.php on line 27
and line 27 is just here :
break;
[B]here[/B]
case "remove_from_cart":
That is the error which comes up whether i am logged in or not to the site.
I hope someone can help me.
Thanks