acidglitter Posted June 2, 2008 Share Posted June 2, 2008 on one of my pages it checks if there is a $_POST variable and a session variable set. if the session variable isn't set then the page automatically refreshes by going to the same url again (but then it loses the $_POST variable). how can i also keep the $_POST variable doing that? isn't there a way to send it? Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/ Share on other sites More sharing options...
trq Posted June 2, 2008 Share Posted June 2, 2008 Save it into the $_SESSION array. Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-556048 Share on other sites More sharing options...
acidglitter Posted June 2, 2008 Author Share Posted June 2, 2008 okay but now for some reason its not getting the saved sessions. whats happening is someone is buying something, then coming back to the site from paypal. on the first time they come back, their member id (saved as a session) is missing. so the page refreshes to get the member id. i tried using header("Location: page") and i just barely tried with html like <meta http-equiv="refresh" content="0;url=page"> but neither will work. what would solve basically everything would be if i could just get the member id saved without having to refresh the page first. Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-556080 Share on other sites More sharing options...
prime Posted June 2, 2008 Share Posted June 2, 2008 how are you storing the session id? in the url or in a cookie? Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-556102 Share on other sites More sharing options...
acidglitter Posted June 3, 2008 Author Share Posted June 3, 2008 do you mean the member id? at the top of the page i just have session_start() Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-556883 Share on other sites More sharing options...
DarkWater Posted June 3, 2008 Share Posted June 3, 2008 Why is their member ID missing? How are you saving it/accessing it? Also, for your information, you can't redirect POST data like that. You can make another POST request to the next page with cURL, but that's completely different than what you're trying to do. Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-556885 Share on other sites More sharing options...
acidglitter Posted June 3, 2008 Author Share Posted June 3, 2008 i'm saving it in a session. normally to get it you would go $_SESSION['member_id']. but because you leave the site to go to paypal, that session kind of temporarily ends, then when you come back you need to refresh the page to get it back again.. Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-556904 Share on other sites More sharing options...
DarkWater Posted June 3, 2008 Share Posted June 3, 2008 That makes no sense. The session does not temporarily end. Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-556906 Share on other sites More sharing options...
acidglitter Posted June 3, 2008 Author Share Posted June 3, 2008 i don't know if thats what it ActuallY does, but you do leave the site and the session isn't being used while you're gone Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-556923 Share on other sites More sharing options...
revraz Posted June 3, 2008 Share Posted June 3, 2008 You need to make sure you are coming back to the same domain that the session was set on, ie www.mysite.com or mysite.com. The session will remain until the browser is closed or times out (24 mins by default). i'm saving it in a session. normally to get it you would go $_SESSION['member_id']. but because you leave the site to go to paypal, that session kind of temporarily ends, then when you come back you need to refresh the page to get it back again.. Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-556924 Share on other sites More sharing options...
acidglitter Posted June 9, 2008 Author Share Posted June 9, 2008 its coming back to httpS://mysite.com does that make a difference? Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-561450 Share on other sites More sharing options...
DarkWater Posted June 9, 2008 Share Posted June 9, 2008 Yes, it does. EDIT: I think. Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-561453 Share on other sites More sharing options...
hamza Posted June 11, 2008 Share Posted June 11, 2008 Dear Just put or assign the varibles in the new session array and encrypte it and decrypt it play with it. how this will be your answer . Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-563021 Share on other sites More sharing options...
revraz Posted June 11, 2008 Share Posted June 11, 2008 What domain set the session? its coming back to httpS://mysite.com does that make a difference? Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-563121 Share on other sites More sharing options...
NorthWestSimulations Posted June 11, 2008 Share Posted June 11, 2008 <?php // Keep this at the top of ur pages session_start(); ?> <?php // Create the form echo "<form action=\"\" method=\"post\"><input name=\"fieldname\" type=\"text\" size=\"8\" maxlength=\"12\" /></form>"; ?> <?php // Call the forms variables and store them into a session array $fieldvar = $_POST['fieldname']; $_SESSION['fieldname'] = $fieldvar; ?> <?php // Call the session back to the document $fieldname = $_SESSION['fieldname']; echo "The field is " . $fieldname; ?> Link to comment https://forums.phpfreaks.com/topic/108455-saving-_post-variables/#findComment-563144 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.