Jump to content
Larry Ullman's Book Forums

Recommended Posts


$returnurl = htmlspecialchars($_SERVER['HTTP_REFERER']);


if(!preg_match('/formpage.php/', $returnurl)) {

echo "<p><a href=\"$returnurl\"><img id=\"lftarrow\" src=\"images/LhArrow.graphic.png\" alt=\"Previous page\">Return</a></p>";

} else {

echo "<p><a href=\"index.html\"><img id=\"lftarrow\" src=\"images/LhArrow.graphic.png\" alt=\"Home page\">Return to Home page</a></p>"; }



I am using this code to provide a path back to the calling page from the page with a form.


My problem is that the form calls its own page in <form method='post' action='formpage.php'> negating what I had hoped to be an elegant return path for the user - hence the if/else defaulting to a fixed url.


Is there anyway of preserving the value of $returnurl whilst the form processes?


Thank you


PS Posted here as I was playing with techniques tried from this book - hope that is correct

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...