[PHP] Question: Exiting a script

2004-11-08 Thread Stuart Felenstein
Say I have a script that processes input data.  How do
I get the script to work, where  after processing the
user is taken to another page ?  The script outputs
nothing to the screen and will end either in failure
or success.  
Seems header won't work for me.


Stuart

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



Re: [PHP] Question: Exiting a script

2004-11-08 Thread Richard Davey
Hello Stuart,

Monday, November 8, 2004, 10:31:51 AM, you wrote:

SF Say I have a script that processes input data. How do I get the
SF script to work, where after processing the user is taken to
SF another page ? The script outputs nothing to the screen and will
SF end either in failure or success.

SF Seems header won't work for me.

A redirect (Location) header is the only way to send the user to
another page from within a PHP script (that or output a meta refresh
tag, which is a bit messy).

Header will work, providing you haven't already output anything - use
the headers_sent() function to test if you've output the headers
already and do something based on that, i.e:

if (headers_sent())
{
   echo 'I have ballsed up somewhere and output some text or
   white-space, aborting';
}
else
{
header('Location: http://www.blah.com/page2.html');
}

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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



Re: [PHP] Question: Exiting a script

2004-11-08 Thread Stuart Felenstein

--- Richard Davey [EMAIL PROTECTED] wrote:

 some
 text or
white-space, aborting';
 }
 else
 {
 
 Richard Davey

I think white space is my problem.  What causes white
space ?

Stuart

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



Re: [PHP] Question: Exiting a script

2004-11-08 Thread Stuart Felenstein
Never mind , I found it!
!DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0
Transitional//EN http://www.w3.org/

TR/xhtml1/DTD/xhtml1-transitional.dtd

One of these days I'll master the header function ;)


Stuart

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



Re[2]: [PHP] Question: Exiting a script

2004-11-08 Thread Richard Davey
Hello Stuart,

Monday, November 8, 2004, 10:46:00 AM, you wrote:

SF I think white space is my problem.  What causes white
SF space ?

Spaces and similar characters, carriage-returns, line-feeds, etc
output to the browser. Perhaps before the opening PHP tag, or after
the closing PHP tag. Any would screw it.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 I am not young enough to know everything. - Oscar Wilde

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