--- In [email protected], Matthew Grimm <[EMAIL PROTECTED]> wrote:
>
> > ----- Original Message ----
> > From: John Black <[EMAIL PROTECTED]>
> 
> 
> 
> > If execute is disabled, I would have one script instruct your
browser to
> > load the next script once the execution is finished of the first.
> 
> > Like so:
> 
> > script1.php:
> >    <?PHP
> >    execute a bunch of code
> >    ......
> >    echo('<head>
> >    <meta http-equiv="refresh" content="0; url=script2.php">
> >    </head>'); ?>
> 
> > script2.php
> >    <?PHP
> >    execute a bunch of code
> >    .....
> >    echo('<head>
> >    <meta http-equiv="refresh" content="0; url=script3.php">
> >    </head>'); ?>
> 
> > Never tried it but I think it should work. You can also pass variables
> > to the scripX.php file like
scriptX.file?nextScript=5&amp;more=info ...
> > let me know how it works.
> 
> 
> That would work, I reckon.  Thanks for the solution.
> 
> What I was hoping to do was to find a way to mimic the Unix
> pipe interface by including a standard input and output stream
> (by way of form variables) that I could use to link together various
> bits of PHP together.
> 
> (There's no piping on the web, but there should be.)
> 
> Matthew
> 

The correct way to do this in PHP is to use header ("Location...

Example
<?PHP
    execute a bunch of code
   ......

   header ("Location: script2.php");
?>

However, that won't work if your script has already output a header,
some html, for example. In that case, you could use the previous
example or use some javascript.

echo("<script>window.location='script2.php';</script>\n";

If you use the 'header (Location:...' method, you can pass variables
from one script to the next using session vars.

Example
script 1:
<?PHP
   session_start();
   execute a bunch of code
   ......
   $_SESSION['myvar'] = $somevar;
   session_write_close();
   header ("Location: script2.php");
?>

script 2:
<?PHP
   session_start();
   $myvar = $_SESSION['myvar'];
   execute a bunch of code
   ......
   $_SESSION['newvar'] = $someothervar;
   session_write_close();
   header ("Location: script3.php");
?>

HTH
Greg
www.sites4all.net

Reply via email to