funbinod Posted May 15, 2014 Share Posted May 15, 2014 i tried to get back to referer page after editing records but it redirected to login page.// this is editprocess page...$refer = $_REQUEST['refer']; // this is stored on a hidden input field on edit.php, that is redirected from http://....../salesRecord.php?echo "<h3>Sales Record Successfully Updated</h3>";include($refer); //echo ing $refer here gives the desired referer page...after clicking 'edit' (submit button) it redirects to login.php page. even the login page should redirect to 'main.php' since it is logged in already (there is a code for it at the top of the page) .... any suggestion???? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 15, 2014 Share Posted May 15, 2014 It sounds like the file you are including is redirecting. Link to comment Share on other sites More sharing options...
funbinod Posted May 16, 2014 Author Share Posted May 16, 2014 (edited) yes! it is redirecting. it is redirecting to the root of webpage. like: the $refer page is "http://localhost/ac/chapat/salesReport.php?" and it is redirecting to "http://localhost/ac/chapat" i just want to include the referer page.... -------------------------- EDIT: but this is working: die(header("location: $refer")); but i need some messege to display with the redirection to the referer page. like after redirection, at the top of the page it should echo "Record posted successfully" and then include the referer page.... using die(header(..........)) doesn't display the messege but only the referer page...... Edited May 16, 2014 by funbinod Link to comment Share on other sites More sharing options...
thescientist Posted May 16, 2014 Share Posted May 16, 2014 if you are redirecting to the referrer page, why do you need to include it? Link to comment Share on other sites More sharing options...
justsomeguy Posted May 16, 2014 Share Posted May 16, 2014 If you want to redirect after a few seconds then use a meta refresh tag instead of sending a location header. Link to comment Share on other sites More sharing options...
funbinod Posted May 17, 2014 Author Share Posted May 17, 2014 (edited) i just wish to display the "success messege" just above the "redirected page" and can't i retrieve referrer page just as file name? not as full address including document root? like http referer gives "http://localhost/referer.php?" but can i get just "referer.php"? it will be helpful if i use different server for different users..... Edited May 17, 2014 by funbinod Link to comment Share on other sites More sharing options...
Ingolme Posted May 17, 2014 Share Posted May 17, 2014 You're going to need code in that target page that checks that an action was performed previously. Link to comment Share on other sites More sharing options...
funbinod Posted May 17, 2014 Author Share Posted May 17, 2014 its again something different @Ingolme, i think. the referer page that i want to redirect back to is not a success page. its the page from where i reached to the edit page and i want to redirect back to the same page after editing the information including success messege.... this is the chain (or cycle) ===> report.php => edit.php => editpost.php => report.php (with success messege) customer.php => edit.php => editpost.php => customer.php (with success messege) in this way won't the action checking code give error when i visit the page before i redirect through editpost.php? Link to comment Share on other sites More sharing options...
Ingolme Posted May 17, 2014 Share Posted May 17, 2014 Yes, and you need some code in that page that determines whether a message should be shown or not. For example, something like this: if(!empty($_SESSION['success_message'])) { echo '<div class="message">'; echo $_SESSION['success_message']; echo '</div>'; unset($_SESSION['success_message'];} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now