How to prevent navigation to a different page in PHP
Submitted by softologi on Sun, 06/15/2008 - 23:23
In order to prevent navigation to a different page you have to do the following:
Call the header function with "HTTP/1.0 204 No Data" as the parameter. See example:
<?php
if($oreventNavigation){
header("HTTP/1.0 204 No Data");
exit();
}
?>In this case the browser will not navigate to a different page and the user will stay in the same page. This is handy in cases that you want to do staff in the back-end server without moving/navigating the user to a different page.
Note: Calling the "header" function must be done before any message is printed to the screen
