Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old March 26th, 2008, 04:15 AM
mtek@mtekusa.com
Guest
 
Posts: n/a
Default Header Question

Hi,

I have a PHP script which performs some processing. And, when that is
done, I want to use the 'header' command to load a different page.

I read that this command must be the first in the script, before
anything else is put to the screen. I have a bunch of coding to
define variables and store them in a MySQL database, but nothing goes
to the screen.

After I perform all my processing, I put the header command in and all
I get is a blank screen?? If I put the command at the top of the
file, it works fine. The problem is, I have conditional statements in
this script, which will load different pages depending on the
condition met:

if (some condition) {
load page 1
} else {
load page 2
}

If hte header must be the first line, how can I accomplish this?

Thanks!

John
  #2  
Old March 26th, 2008, 04:45 AM
Martin
Guest
 
Posts: n/a
Default Re: Header Question

On Tue, 25 Mar 2008 20:13:33 -0700 (PDT), mtek@mtekusa.com wrote:
Quote:
>Hi,
>
>I have a PHP script which performs some processing. And, when that is
>done, I want to use the 'header' command to load a different page.
>
>I read that this command must be the first in the script, before
>anything else is put to the screen. I have a bunch of coding to
>define variables and store them in a MySQL database, but nothing goes
>to the screen.
>
>After I perform all my processing, I put the header command in and all
>I get is a blank screen?? If I put the command at the top of the
>file, it works fine. The problem is, I have conditional statements in
>this script, which will load different pages depending on the
>condition met:
>
>if (some condition) {
load page 1
>} else {
load page 2
>}
>
>If hte header must be the first line, how can I accomplish this?
>
>Thanks!
>
>John
It doesn't have to be the first thing in your script but it does have
to be the first thing that is served out. I have a couple of scripts
where the header is 25-30 lines down in the script; but, it's the
first thing that the script sends out

Check your script. You must have something being served out prior to
your header. Maybe something in an included file that's at the top of
your script?


  #3  
Old March 26th, 2008, 04:45 PM
Guillaume
Guest
 
Posts: n/a
Default Re: Header Question

mtek@mtekusa.com a écrit :
Quote:
Quote:
Quote:
>>>Just ensure you have no space before or after the braces in the included
>>>file. ANY output - even white space - will cause headers to be sent
>>>and, as a result, the header() call to fail.
[...]
Quote:
What do you suggest to solve the issues?
Exactly what he said above, there is really no need for ob_* functions
when you can just pay attention (and possibly activate errors display).

--
Guillaume
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles