phpQuestioner Posted August 5, 2007 Share Posted August 5, 2007 I am trying to send a random number from my first page to my second page with a session. That works fine, but the reason I am sending this random number from my first page to my second page with a session; is because I have used it to set a cookie and I want my second page to check for the cookie. The cookie sets fine, but when I try to check for my cookie in my second page; it does not work. Here Is The Code For My Second Page: <?php session_start(); ?> <html> <head> <title>Untitled</title> </head> <body> <?php $tta = $_SESSION['cookie']; if (empty ($_COOKIE['$tta'])) { echo "You Are Not Logged In"; } else { echo "Welcome Back To...."; } ?> </body> </html> If I echo "$tta"; it produces the name of the cookie, but once I put "$tta" in the empty cookie validation; it is not recognizing the session variable. Any one know why this is not working? Quote Link to comment https://forums.phpfreaks.com/topic/63451-solved-having-problem-with-setting-cookie-with-session-variable/ Share on other sites More sharing options...
phpQuestioner Posted August 5, 2007 Author Share Posted August 5, 2007 Well any way - I figured it out........... <?php session_start(); ?> <html> <head> <title>Untitled</title> </head> <body> <?php if (empty ($_COOKIE[''. $_SESSION['cookie'] .''])) { echo "You Are Not Logged In"; } else { echo "Welcome Back To...."; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/63451-solved-having-problem-with-setting-cookie-with-session-variable/#findComment-316226 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.