Session Variable shows in one part of page but not other.
Posted: Tue Jan 09, 2007 10:58 pm
I have a customer account page that is just in development right now. And I have a php file that is included in all pages that is a menu.php file for the menu bar. When the customer is logged in it's supposed to show an extra link to the orders page. Problem is that it works on the home page and not the customer account page. But also on the customer account page I have an if statement checking to see if the variable is set. The if statement shows that the variable is set, but on the same page when I include the menu.php file it isn't set. If anyone can help me I would greatly appreciate it. Here's the code.
menu.php (partial code)
customeraccount.php (complete code)
Thanks again for the help.
menu.php (partial code)
Code: Select all
<html>
<?php
session_start();
?>
<TABLE WIDTH=800 BORDER=0 CELLPADDING=0 CELLSPACING=0 align="center">
<tr>
<td width="800" colspan="2"> <img src="http://weprint4you.com/images/topbar.jpg"> </td>
</tr>
<TR >
<TD width="200" height="30">
<IMG SRC="http://weprint4you.com/images/menu_01.gif" ALT="menu_01.gif"></TD>
<TD background="http://weprint4you.com/images/menu_02.gif" align="center" width="600" height="30"> |
<?php if ($_SESSION['customerLoggedIn'] == 1){ ?>
<a href="https://weprint4you.com/customerorders.php">Customer Orders</a> |
<a href="http://weprint4you.com/createorder.php">Purchase New Print</a> |
<a href="http://weprint4you.com/pricing.php">Products & Pricing</a> |
<a href="http://weprint4you.com/contact.php">Contact Us</a> |
<?php } else if ($_SESSION['employeeLoggedIn'] == 1) { ?>
<a href="../httpdocs/employeeSales.php">Employee Sales</a> |
<a href="../httpdocs/employeePromos.php">Promotional Codes</a> |
<?php } else {?>
<a href="http://weprint4you.com/createorder.php">Purchase New Print</a> |
<a href="http://weprint4you.com/pricing.php">Products & Pricing</a> |
<a href="http://weprint4you.com/contact.php">Contact Us</a> |
<?php } ?>
</td>Code: Select all
<?php
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Customer Account</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<?php include("http://weprint4you.com/menu.php"); ?>
<p>Went Through</p>
<?php if ($_SESSION['customerLoggedIn'] == 1)
{
echo 'customer logged in';
}
else
{
echo 'customer not logged in';
}
?>
</body>
</html>