spearchilduser Posted April 18, 2012 Share Posted April 18, 2012 hey i think i may have stored session variables incorrectly $_SESSION['tel'] = $_GET['Lat']; $_SESSION['Lon'] = $_GET['Lon']; $_SESSION['Lat'] = $_GET['Lat']; is what i used to set the session variables with the data i then enter these into a table and they enter the correct information but two pages down the line i try to access them however i just get undefined variable when i set the variable is equal to the session. $MyLon = $_SESSION['Lon']; $MyLat = $_SESSION['Lat']; the following is the errorr Notice: Undefined index: Lat in Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/ Share on other sites More sharing options...
joecooper Posted April 18, 2012 Share Posted April 18, 2012 make sure each page has session_start(); at the top Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338456 Share on other sites More sharing options...
spearchilduser Posted April 18, 2012 Author Share Posted April 18, 2012 Yer they all have <?php session_start(); at the top of every page Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338457 Share on other sites More sharing options...
joecooper Posted April 18, 2012 Share Posted April 18, 2012 what is the code your using to retrieve the varibles? Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338460 Share on other sites More sharing options...
batwimp Posted April 18, 2012 Share Posted April 18, 2012 Post the line where the error is pointing. Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338464 Share on other sites More sharing options...
spearchilduser Posted April 18, 2012 Author Share Posted April 18, 2012 $MyLon = $_SESSION['Lon']; $MyLat = $_SESSION['Lat']; echo $MyLon; echo $MyLat; as this is not showing me the results i expect im not tryign to use the data just yet Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338466 Share on other sites More sharing options...
batwimp Posted April 18, 2012 Share Posted April 18, 2012 Have you verified your GETS are passing in values before you assign them to the session variables? var_dump($_GET); Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338467 Share on other sites More sharing options...
spearchilduser Posted April 18, 2012 Author Share Posted April 18, 2012 Yes im using the original gets to enter the information into the session variables then on the same page usign the session variables to enter the data into a table to check they were working Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338468 Share on other sites More sharing options...
spearchilduser Posted April 18, 2012 Author Share Posted April 18, 2012 aww sorry i dnt know what var_dump($_GET); is or how it woudl be used Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338470 Share on other sites More sharing options...
batwimp Posted April 18, 2012 Share Posted April 18, 2012 It will print to the screen what is currently in your $_GET array. It will let you know if they are being populated correctly from your form. Put it right before you assign to your session array: var_dump($_GET); $_SESSION['tel'] = $_GET['Lat']; $_SESSION['Lon'] = $_GET['Lon']; $_SESSION['Lat'] = $_GET['Lat']; This will print some text out to the screen to let you know what is in your GET array. Copy that output and paste it here. Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338474 Share on other sites More sharing options...
spearchilduser Posted April 18, 2012 Author Share Posted April 18, 2012 thats gunna be a little difficult becuase the information is gathered on the login page which then goes to another page whcih checks the login details and where it stores the details into sessions then redirects you to another page so at no point can i check but now ive added that line in it does like the page syas theres a problem Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338485 Share on other sites More sharing options...
batwimp Posted April 18, 2012 Share Posted April 18, 2012 Ok, so for debugging purposes, stop the script right after the dump so you can see if there's anything in there: var_dump($_GET); exit; $_SESSION['tel'] = $_GET['Lat']; $_SESSION['Lon'] = $_GET['Lon']; $_SESSION['Lat'] = $_GET['Lat']; Quote Link to comment https://forums.phpfreaks.com/topic/261178-sessions/#findComment-1338487 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.