Re: passing control to a separate script

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

 



At 9:17 PM -0400 5/1/11, Jim Giner wrote:
I have a large script that does a certain function for me.  I have a second
script that gets called and does its thing and when I'm done with it I'd
like to pass control to the first script.  I don't need this 'included' in
my second script - I just want to pass control to it and let it take over
again.

Is this do-able?

Yes, this is do-able.

But don't be afraid of the include statement.

Here's an example that can be easily made to do what you want:

http://www.webbytedd.com/bb/php-run-php/

After the first script runs, it includes the second script that then runs, which then includes the first script to continue.

If you don't want to use a $_POST to trigger the critter, then use location, such as:

// first script
if($to_second_script)
  {
   header('Location: http://www.example.com/second.php');
   exit();
   }

// second script
if($to_first_script)
  {
   header('Location: http://www.example.com/first.php');
   exit();
   }


Either those will work depending upon the trigger you need.

Cheers,

tedd

--
-------
http://sperling.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