loren646 Posted February 24, 2013 Share Posted February 24, 2013 (edited) update.php <?php session_start(); $_SESSION['owner']=$_POST['ownert']; $owner=$_SESSION['owner']; [/i] SUBMIT button goes to updateprocess.php ?> [u]updateprocess.php[/u]<?phpheader('Location: http://www.website.com/update.php'); [i][code][/i] ?> i read online and tried putting session_start(); on updateprocess.php but that doesn't seem to work either. Edited February 24, 2013 by loren646 Quote Link to comment https://forums.phpfreaks.com/topic/274872-using-session-and-after-header-redirect-session-is-gone/ Share on other sites More sharing options...
denno020 Posted February 24, 2013 Share Posted February 24, 2013 session_start() must be the very first line in any php script that you want to use to access the session variables. Quote Link to comment https://forums.phpfreaks.com/topic/274872-using-session-and-after-header-redirect-session-is-gone/#findComment-1414521 Share on other sites More sharing options...
Jessica Posted February 24, 2013 Share Posted February 24, 2013 (edited) $_POST['ownert']; ownert?? Edit: and actually you said when you submit it goes straight to the other page. So your code to put the variables IN the session won't ever work. Edited February 24, 2013 by Jessica Quote Link to comment https://forums.phpfreaks.com/topic/274872-using-session-and-after-header-redirect-session-is-gone/#findComment-1414522 Share on other sites More sharing options...
loren646 Posted February 24, 2013 Author Share Posted February 24, 2013 $_POST['ownert']; ownert?? Edit: and actually you said when you submit it goes straight to the other page. So your code to put the variables IN the session won't ever work. sorry, i couldn't edit. owner"T" is just a typo here and not in the actual program. This code is the the 2nd page. the first page is an html with a submit button. $_SESSION['owner']=$_POST['owner']; now that we have $_SESSION['owner'] i can echo it and it displays. Now i have to process information on this page (update.php). and it processes it on the next page (updateprocess.php) and redirects back to update.php. Now update.php does NOT have $_SESSION['owner']. Quote Link to comment https://forums.phpfreaks.com/topic/274872-using-session-and-after-header-redirect-session-is-gone/#findComment-1414560 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.