Page 1 of 1

Need help about SESSION

Posted: Mon Mar 08, 2010 7:45 pm
by mlhazan
Please help me.I am working on a shopping cart project.What i am trying is use a session variable.The problem is when the user is logged index can get the $_SESSION['valid_user'] variable without an error but unlogged user get an error message on the page like :

Code: Select all

Undefined index: valid_user in /opt/lampp/htdocs/practice/log/test/index.php
if I make two different page one for logged and another for unlogged it will work but that way my project will become double.I know there is some where a way but need help.
I am stacked at this point and can't go farther .Please help me.

Re: Need help about SESSION

Posted: Mon Mar 08, 2010 8:01 pm
by requinix
You can use isset to check if a variable or element in an array exists.

Add to that some logic that decides what to do if they're logged in or not.