Page 1 of 1

Exiting in a include page.

Posted: Sun May 20, 2007 8:09 pm
by JellyFish
page 1:

Code: Select all

<?php
exit; //replace with a function or that would just stop this page 1 from running.
?>
page 2:

Code: Select all

<?php
include("page1.php");

echo "This should display";
?>
How do I only exit an include script and not effect the echo statement in page 2?

Posted: Sun May 20, 2007 8:57 pm
by Stryks
Can you give an example of what you are trying to achieve?

Are you trying to find out how to stop page 1 being called unless page 2 requests it, or how to stop page 1 from exiting when included in page 2?

If its the latter ... ummm ... dont put exit in there?

Clarification of what you are trying to achieve might yield better feedback. 8)

Posted: Sun May 20, 2007 9:03 pm
by maliskoleather
i think i understand what youre asking.

use return instead of exit.

exit stops php all together. return stops the current script, and if used in a function or include, sends you back to the parent item.