I am some problems creating a redirect from a php file.
Now, here's teh problem. On my site - let's take this page - http://antobbo.webspace.virginmedia.com/webediting/content.htm I have a comment form that sends me an email everytime somebody submits the form. Now, the php file is configured so that if I send submit the form from any page of my website the user is then redirected to the home page after 5 seconds.
Here's the php file:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8"> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <meta http-equiv="REFRESH" content="5;url=http://www.antobbo.webspace.virginmedia.com/webediting/home.htm"> <link rel="stylesheet" type="text/css" href="style.css" > <title>Thank you</title> </head> <body> <div id="wrapper"> <!-- BANNER STARTS HERE --> <div id="banner"> <h1>Web editing - Livelink WCM</h1> </div> <div id="text_navigation"> <?php $to = "firstname.lastname@example.org"; $subject = "Comments on page"; $message = $_POST["comments"]; mail($to,$subject,$message); echo "<h2>Thank you</h2><p><br><br>Thank you for sending your feedback. That will help me improve the website.<br><br></p>"; ?> </div> </div> </body> </html>
What I am trying to do is to make sure that if you submit the form from page A then the php files redirects you to page A and not to the home page. In the case above if I submit the form from the "Content issues" page I want the redirect to bring me back to that particular page.
I was taking a look around and reading a bit about this. I haven't written any code yet, and I was wondering if the php session would be a good way to do it, or if there is any other way to do it. The thing is I don't know what variable can represent a specific page, to be used, for instance, in the php session...any suggestion?