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? Quote Link to comment Share on other sites More sharing options...
trq Posted June 2, 2008 Share Posted June 2, 2008 Save it into the $_SESSION array. Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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() Quote Link to comment 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. Quote Link to comment 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.. Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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.. Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
DarkWater Posted June 9, 2008 Share Posted June 9, 2008 Yes, it does. EDIT: I think. Quote Link to comment 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 . Quote Link to comment 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? Quote Link to comment 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; ?> 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.