Re: [PHP] PHP command for redirect?

2002-05-29 Thread Jason Wong

On Wednesday 29 May 2002 15:37, Tim Thorburn wrote:
 Hi,

 I'm setting up an error checking element to a registration site and would
 like to redirect the user to a certain page if they missed any fields on
 the previous registration page ... the problem is I can't seem to find a
 redirect command for PHP.

 I was using the header command, but its giving me attitude now that I've
 also got the script setup to send an email to the admins if a form is
 filled out incorrectly.

 I just went through the list of commands on the PHP website - but without
 really knowing what kind of name I'm looking for ... well, it wasn't all
 that enlightening.

Well the 'command' for redirect is header(). What attitude is it giving you?

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *

/*
system consumed all the paper for paging
*/


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




Re: [PHP] PHP command for redirect?

2002-05-29 Thread Tim Thorburn

The error the header() command is giving me now is:

Warning: Cannot add header information - headers already sent by (output 
started at \registrations\reg_mudfling.php:5)

I've moved the header command around (line position) and still nothing ... 
not sure why its suddenly not working.  I've been trying to add an extra 
feature to the form - sending an email to the admins if the form doesn't 
get entered into the database, but even when I take the email part out its 
still giving this error message.

Any ideas?

Thanks
-Tim


Re: [PHP] PHP command for redirect?

2002-05-29 Thread Miguel Cruz

On Wed, 29 May 2002, Tim Thorburn wrote:
 The error the header() command is giving me now is:
 
 Warning: Cannot add header information - headers already sent by (output 
 started at \registrations\reg_mudfling.php:5)
 
 I've moved the header command around (line position) and still nothing ... 
 not sure why its suddenly not working.  I've been trying to add an extra 
 feature to the form - sending an email to the admins if the form doesn't 
 get entered into the database, but even when I take the email part out its 
 still giving this error message.

This means you are generating some other output (either intentionally, or 
through whitespace outside your PHP tags) before calling the header() 
function.

That's a no-no. You can get around it by using output buffering, but it 
doesn't change the fact that you don't want to generate any output if 
you're going to redirect the user to another page.

Do all your checking silently, then either redirect them somewhere else, 
or start sending output as normal, depending on the result of your checks.

miguel


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