There are some scripts that process the data, and then you need to return to the previous page, I do it through

public static function GoBack() { if (@$_SERVER['HTTP_REFERER'] != null) { header("Location: ".$_SERVER['HTTP_REFERER']); } Sys::GoHome(); } 

but always Sys :: GoHome ();

what could be wrong here?

  • add after header (...) return. - KoVadim

2 answers 2

Found,

 if (...) { header("Location: ".$_SERVER['HTTP_REFERER']); } Sys::GoHome(); 

It turns out after header() , execution continues, it was necessary to write through else

    Try to use after the function header($str); the function that completes the execution of the php script exit();