Adrian56 Posted June 16, 2013 Share Posted June 16, 2013 <?php $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 comment Share on other sites More sharing options...
HartleySan Posted June 16, 2013 Share Posted June 16, 2013 Add all the name-value pairs from the first page of the form to the second page of the form as hidden inputs. Then, when you resubmit back to the first page, you can grab all those name-value pairs and use them as necessary. 1 Link to comment Share on other sites More sharing options...
Recommended Posts