RE: [PHP] header() ???
| From: | Sonia Tsui | Date: | Thu, 14 Sep 2000 03:54:49 +0000 |
| Subject: | RE: [PHP] header() ??? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16687@lists.php.net to get a copy of this message | ||
Hans,
Yup, you are right! I was thinking exactly of what you mentioned here: how
to output the Content-type: text/html etc that I need to call in Perl.
Thanks very much for clearing up this for me.
thanks
---Sonia
=====================================
Sonia,
It looks like you come from a Perl background and wonder how to output the
Content-type: text/html or whatever that you need to call in Perl. While
Perl is wonderful, it wasn't designed specifically for web use. PHP was,
and it automagically includes most of the necessary headers. The only
time you will use header() is when you need to *add* a header to the ones
already being sent. The most common use is to redirect a user. For now,
though, don't worry about it. Perl needs the headers to be explicity sent
by you, PHP doesn't.
Hans
On Wed, 13 Sep 2000, Sonia Tsui wrote:
> Hi,
>
> but I can simply do this:
> if (!input_valid(..)) {
> include "error.php";
> }
>
> why is header() needed?
>
>
> > Could you please give me a case under which header() need to be used?
>
> You may wish you verify a user's form input, and redirect them to an
> error page if it is not filled in properly. Or you may want to redirect
> on, say, a checkout page if you can't find a session identifier.
>
> Jason
>
>
--
Hans Anderson -=- me@hansanderson.com
http://www.hansanderson.com | PHP, SQL Databases, Flash 5
Animation &
http://www.goofiness.com | Programming, Audio Production,
Brewmeister.