I have a page where I need to get the referring URL so I can redirect them back after they compete a form. My problem is, the form has several drop menus and each time a selecti
If you insist on doing it with forms and hidden inputs, that's easy.
You could also do it with sessions, though, supposing you use session_start().
session_start();// At the very top of your page. Literally THE TOP.
// Set our session variable only if it is not currently set.
if (!isset($_SESSION['referrer'])) {
$_SESSION['referrer'] = $_SERVER['HTTP_REFERER'];
}
For more on sessions, see this. Sessions were meant for just this sort of thing, taking variables across pages and preserving state.