473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
Mar 26 '08 #1
2 1303
On Tue, 25 Mar 2008 20:13:33 -0700 (PDT), mt**@mtekusa.com wrote:
>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?
Mar 26 '08 #2
mt**@mtekusa.com a écrit :
>>>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.
[...]
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
Mar 26 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stijn Goris | last post by:
Hi all, I have a question regarding the header function. I send a browser to a certain page (eg first.php ) wich sends no output to the browser. This page sends the browser to another page (eg...
6
by: John | last post by:
Hi. I am having a few header problems at the moment with a login page. I don't have my headers at the top of the page where I've learned I need to have them. However, I also know I'm supposed...
31
by: Steven T. Hatton | last post by:
If a header is not necessarily a source file, and the sequences delimited by < and > in header names aren't necessarily valid source file names, what exactly is a header? -- p->m == (*p).m == p.m...
6
by: Johannes Bauer | last post by:
Hi group, I've got a question concerning inclusion of .hpp files. Currently I'm including all needed header files in the .cpp file. This means all dependencies of the package and all...
3
by: Sujan Datta | last post by:
What are the possible effects of modifying an existing header file, which includes bunch of defines, function prototypes and some struct definitions. The structure of the header file looks...
60
by: Derrick Coetzee | last post by:
It seems like, in every C source file I've ever seen, there has been a very definite include order, as follows: - include system headers - include application headers - include the header...
2
by: Joey Martin | last post by:
This is more of a flash recommendation question than ASP related, but I use this forum a lot, so wanted to see if anyone can answer. My page header is flash. One the header is flash. It's about...
7
by: The Cool Giraffe | last post by:
Please note that i do intend to use a header file. However, i'm not sure if it's really needed or just a convention. Suppose we have the following two files. // Something.h class Something {...
5
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I have a sub in vb.net that adds extra headers to a gridview and it works very well. however, i tried to translate it to c# and i'm getting the header inserting itself over the first datarows and...
6
by: Ramon | last post by:
Is there a way to initialize the variables (or other data) of a header file by using a function (similar to main() function)?? Thankx
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.