RE: [PHP] header() ???
| From: | Sonia Tsui | Date: | Thu, 14 Sep 2000 02:27:01 +0000 |
| Subject: | RE: [PHP] header() ??? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16671@lists.php.net to get a copy of this message | ||
Hi David,
Sorry that I didn't quite get it :)
What do you mean by any lines or spaces before that will cause an error.
I am confused because usually when we want to display an html page, we can
just use ---include "filename.php"
why this time I need to add header().
---Sonia
-----Original Message-----
From: David Robley [mailto:huntsman@hermes.nisu.flinders.edu.au]
Sent: Wednesday, September 13, 2000 7:26 PM
To: Sonia Tsui; 'php-general@lists.php.net'
Subject: Re: [PHP] header() ???
On Thu, 14 Sep 2000, Sonia Tsui wrote:
> When does header() need to be called?
>
> let's say:
>
> =========
> index.php
> =========
> <a href="<?php echo("myscript.php"); ?>...... </a>
>
>
> ==========
> myscript.php
> ==========
>
> <?php
> $cmd = "something";
> exec("$cmd");
> <--------- header() ????
> include "index.php";
> ?>
> -------------------------------------
> I asked since for Perl CGI, this is needed:
>
> print header;
> if (open(fp,"<index.php")) {
> while (<fp>) {
> print;
> }
> }
>
>
> ---Sonia
In a nutshell, it needs to be called before you send ANY output; even
spaces or empty lines before it will cause errors.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA