Re: Am I blind? simple 15 line code producing error
| From: | Hugh Danaher | Date: | Sun, 03 Nov 2002 20:23:02 +0000 |
| Subject: | Re: Am I blind? simple 15 line code producing error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-122579@lists.php.net to get a copy of this message | ||
Paul,
Got any spaces or lines above the "<?" ?? Spaces there will kill the
script.
Hugh
----- Original Message -----
From: "Paul" <pax@cfl.rr.com>
To: <php-general@lists.php.net>
Sent: Sunday, November 03, 2002 9:53 AM
Subject: [PHP] Am I blind? simple 15 line code producing error
> Perhaps I am blind but I have the following simple code that gets me
> errors:
> <?php
> session_start();
> require_once ("config.inc");
> require_once "classes/HtmlTemplate.class";
>
> if ($HTTP_SESSION_VARS[user_id]){
> //do something
> } else {
> $message= "*** Area is restricted! Please login! ***";
> $m= urlencode($message);
> $sid_value="&PHPSESSID=".session_id();
> header("Location:
> index.php?error_message=$m$sid_value");
> exit;
> }
> ?>
>
> The error is:
> Warning: Cannot add header information - headers already sent by (output
> started by.. ..line 6) ...on line 12
>
> Line 6 is the line with if ($HTTP_SESSION_VARS[user_id])
> Line 12 is the line starting with header
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>