Jump to content

failed to include referer page


funbinod

Recommended Posts

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

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 by funbinod
Link to comment
Share on other sites

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 by funbinod
Link to comment
Share on other sites

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) ===>

  1. report.php => edit.php => editpost.php => report.php (with success messege)
  2. 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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...