doforumda Posted May 21, 2011 Share Posted May 21, 2011 Hi I am using very simple code. Here it is <?php session_start(); $user = "guest"; $uid = "1"; echo $_SESSION['user']."<br />"; echo $_SESSION['uid']; ?> it displays this error Notice: Undefined index: user in C:\wamp\www\DealDash\index.php on line 5 Notice: Undefined index: uid in C:\wamp\www\DealDash\index.php on line 6 how can I solve this problem? Help please Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted May 21, 2011 Share Posted May 21, 2011 <?php session_start(); $_SESSION['user'] = "guest"; $_SESSION['uid'] = "1"; echo $_SESSION['user']."<br />"; echo $_SESSION['uid']; ?> Quote Link to comment Share on other sites More sharing options...
Genesis730 Posted May 21, 2011 Share Posted May 21, 2011 It's giving you an error for anytime you use a variable that hasn't been inialized yet. To stop that, just post this BEFORE the error (I.E. the variables are used) <?php error_reporting(E_ALL ^ E_NOTICE); ?> Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted May 21, 2011 Share Posted May 21, 2011 To stop the warning, fix the condition that is causing the warning in the first place. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.