[RESOLVED] Need an explanation of 'exit' keyword
Posted: Sun Mar 11, 2012 3:43 pm
Greetings all,
I've got a main php page that has the following code:
And, under certain circumstances, this is what is encountered in $contentfile:
The problem I'm encountering is that when the exit; is encountered it stops ALL php/html processing - so the last thing that is sent to the browser is the closing </script> tag. I'd like to understand what is going on with the exit command AND find an alternative that will return back to the wrapper/parent page and allow it to continue processing to the browser.
I've got a main php page that has the following code:
Code: Select all
<div id="bothrcontent">
<?PHP
// get navigation based on page called by URL
if(in_array($needle, $haystack)){
$contentfile = $needle.".php";
require $contentfile;
}
?>
</div>
Code: Select all
function error($msg) {
?>
<script type="JavaScript">
<!--
alert('<?=$msg?>');
history.back();
//-->
</script>
<?
exit;
}