Re: javascript label inside php code.
| From: | Rasmus Lerdorf | Date: | Thu, 21 Jun 2001 16:12:59 +0000 |
| Subject: | Re: javascript label inside php code. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-54757@lists.php.net to get a copy of this message | ||
> Warning: Cannot add header information - headers already sent by
> (output started I understand that one of the reasons for this erro
> message is if their is a trailing space after a ?>. I have some PHP
> code which produces javascript rollover code. Above this there are a
> few includes referencing database and authorization files. Then I
> there is this peice of code
Well, JavaScript is client-side stuff which is of course output. You
cannot have anything that needs to set an http header. Such as Header(),
SetCookie() or session_start().
You can use output buffering to get around this limitation, but it is
somewhat expensive. Your best bet is to modify your logic so anything
that needs to send a header happens before any output at all.
-Rasmus