xander85 Posted August 1, 2007 Share Posted August 1, 2007 Hey All, This is problem either a stupid or very easy question, any suggestions are greatly apreciated. I have a section on my website where only users that are "logged in" can view and I'm using the following syntax at the top of verify that they are logged in and that they can only view their profile: if((!$session->logged_in) || (($session->num != $_GET[num]) && ($session->num != $_POST[num]))) { header("Location:websiteaddresshere"); exit; } This works great. The get to your account you have to be logged in and use the user: account.php?num=# or else you are redirected. My problem is as follows. I have a section to edit your account details that uses the same code as above. However, once you submit the form on accountedit.php, it redirects to the main website address instead of displaying some text saying the edit worked successfully. How do I submit a form and add "?num=$usernum" to the end of the website url so they aren't redirected? Quote Link to comment https://forums.phpfreaks.com/topic/62901-solved-retain-variables-after-form-submit-redirect-help/ Share on other sites More sharing options...
xander85 Posted August 1, 2007 Author Share Posted August 1, 2007 bump Quote Link to comment https://forums.phpfreaks.com/topic/62901-solved-retain-variables-after-form-submit-redirect-help/#findComment-313142 Share on other sites More sharing options...
hostfreak Posted August 1, 2007 Share Posted August 1, 2007 Use the following for your form action: action="accountedit.php?num=<?php echo $usernum; ?>" Quote Link to comment https://forums.phpfreaks.com/topic/62901-solved-retain-variables-after-form-submit-redirect-help/#findComment-313144 Share on other sites More sharing options...
xander85 Posted August 1, 2007 Author Share Posted August 1, 2007 Awesome, I found out where to fix the issue. My form actually uses another file but it used another header("Location:" redirect and I was able to add the variable on to that. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/62901-solved-retain-variables-after-form-submit-redirect-help/#findComment-313160 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.