473,473 Members | 2,207 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Changing pages: header('location') or PHP require()?

Hi all,

Just wondering whether there was any standard way of serving up a new
page to the browser when the user has submitted the current page.

Currently I:
1) Process any user submitted data in the current page
2) Send a header('location') redirect to the browser, which then
requests the new page.

I was considering that is it probably more efficient PHP to serve up
the new page contents immediately, without requiring another HTTP
request from the browser and the subsequent PHP setup overhead. Also
this would prevent having to store stuff in the user session to
maintain state. I was going to try this with require(), but
immediately hit problems in that my pages have functions called the
same thing, so PHP falls over. Upon thinking about it further I could
can also see possible problems with $_POST data containing stuff from
the old page that could screw up the new page, and possible wierdness
with the browser address bar still having the old page address.

Is there an accepted way of doing this? Or is just a case of weighing
up the pro's and cons.

Cheers,
Lister

May 30 '07 #1
1 1634
lister wrote:
Currently I:
1) Process any user submitted data in the current page
2) Send a header('location') redirect to the browser, which then
requests the new page.
This is the best option as it discourages reloads. (e.g. browser F5 key.)

--
Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux 2.6.12-12mdksmp, up 95 days, 18:37.]

Non-Intuitive Surnames
http://tobyinkster.co.uk/blog/2007/0...tive-surnames/
May 30 '07 #2

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

Similar topics

4
by: Jeff | last post by:
I've been able to find this question on a Google group search but not the answer. Plus I'm a late convert to php transferring over from ASP. I hope this isn't too many strikes against me. When I...
6
by: Filth | last post by:
Hi this is probably very easy to sort but I want to do the following:- header( "Location: subscribe_form.php?name='.$_GET.'&email='.$_GET.'"); but this pulls up the error:- Parse error:...
10
by: Margaret MacDonald | last post by:
I'm seeing a problem that has me flummoxed. The only thing I can think of is that I'm violating some rule I don't know about. I have some code that does some processing and then does a...
2
by: Stephen Preston | last post by:
I have a split frame which holds in the upper part a php file with a header location function, which opens a new file (lower.php). I'm trying to get the header function to open lower.php in the...
23
by: lwoods | last post by:
I am trying to pass some info to another page on my site. I set "session_start()" in page 1, assign a session variable to a value, then execute a "header('Location: ....')." But on the target...
2
by: Ladbroke | last post by:
Hiya, got a little prob with the syntax for header ( ' Location .... with variable). Usually examples are given with a complete URL, like: ..... header( 'Location: login/testsite/start.php'...
6
by: P-Rage | last post by:
Hello everyone, I was wondering what could possibly cause Internet Explorer 6 to loop a page usging a header(Location:) statement. For example, a page called 'page1.php': if((isset($_POST))...
4
by: geshan | last post by:
In php5 I am not able to use include funciton and header("location:""" together please help.
8
by: pedalpete | last post by:
I thought this should be simple, but i can't seem to get it to work. I'm trying to do a simple redirect to a page, but need to pass a variable. I've tried a few things, but nothing seems to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
1
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.