473,770 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1319
On Tue, 25 Mar 2008 20:13:33 -0700 (PDT), mt**@mtekusa.co m 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.co m 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
4443
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 second.php) with the header("Location:") function. second.php doesn't either send any output to the browser. The browser is then send to another page also with the header() function. Now my problem: I have to send user and password data...
6
3434
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 to have the session_start(); at the top of the page as well. So when you have two things that need to be the first which do you put first? And if I put one before the other will that cause problems? Below is a copy of the php from my page. It...
31
2806
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 http://www.kdevelop.org http://www.suse.com http://www.mozilla.org
6
1754
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 dependencies of these dependencies and so on. This is quite ugly. A start of an "Example.cpp" file could look like this
3
2055
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 something like this //Start of header Define Define Define Define
60
8318
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 associated with this source file For example, in a file hello.c: #include <stdio.h>
2
1312
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 500KB. 2 questions. 1. Do you recommend keeping flash in the header so it loads on each page, or creating a second image to replace the header on all the secondary pages.
7
2249
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 { private: int number; public: Something ();
5
1972
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 inserting blank rows at the bottom. i can post the code if necessary for the C# but it basicly mirrors the vb.net -- (i''ll be asking a lot of these, but I find C# totally way cooler than vb
6
9470
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
9591
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10057
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10002
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.