Re: passing control to a separate script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Monday, 2 May 2011 at 05:21, Jim Giner wrote:
Script 1 calls script 2. Script 2 has several paths in it which is how the 
> user gets to interact with it. Once the final path has been taken (data 
> gets written) I don't want to use script 2 any longer - I want script 1 to 
> begin, by a call from the "executing" script 2 that will initiate script 1 
> and then script 2 goes away since script 1 will have control. It's kind of 
> like passing a baton in a relay race.

You want script 1 to begin again? In that case simply include script1 from script2 then call exit immediately afterwards. The only way to make use of another script without it returning back to the current script once it's done is if that other script calls exit or die to end execution.

When you say script 1 "calls" script 2, what do you actually mean? Is it included, are you calling a function in script 2, or is the user clicking on a link / submitting a form that runs script 2?

To get "script 1 to begin" from script 2 based on a certain path...

script2.php
---
if ($path1)
{
// do stuff here
include('script1.php');
exit;
}
// otherwise do other stuff here
---

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux