473,396 Members | 2,017 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,396 software developers and data experts.

header location and redirect

From my record insertion page I do, in some cases, this:

header("Location: http://$SERVER_NAME/mainpage.php?SID");

problem is that the mainpage.php doesn't takes new datas. I've to refresh
the page to see the new inserted record.

doing this:
header("Refresh: 0; URL=http://".$_SERVER['HTTP_HOST']."/mainpage.php?SID);

isn't considered a good alternative.
I want to redirect to the mainpage.php with refreshed datas.

How to do so ? may I keep Refresh header command or it will not work on some
browser ?

Bob
Aug 25 '05 #1
3 2929
On 2005-08-25, Bob Bedford <be******@notforspammershotmail.com> wrote:
From my record insertion page I do, in some cases, this:

header("Location: http://$SERVER_NAME/mainpage.php?SID");

problem is that the mainpage.php doesn't takes new datas. I've to refresh
the page to see the new inserted record.


What is going on in mainpage.php? Are you sure the record insertion page
really does what you expect? Checked for errors??

If you start your scripts with the code below, you usually get some
hints ;)

ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);

--
Met vriendelijke groeten,
Tim Van Wassenhove <http://timvw.madoka.be>
Aug 25 '05 #2
*** Bob Bedford wrote/escribió (Thu, 25 Aug 2005 18:48:08 +0200):
I want to redirect to the mainpage.php with refreshed datas.

How to do so ? may I keep Refresh header command or it will not work on some
browser ?


That's the default setting for most PHP installs: to tell the browser not
to cache the page. Though I don't think that's the problem, you can play
around with this headers in mainpage.php:
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', time()-86400*365*10) . ' GMT');
header('Expires: ' . gmdate('D, d M Y H:i:s', time()-86400*365*10) . ' GMT');
// HTTP/1.1
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', FALSE);

// HTTP/1.0
header('Pragma: no-cache');
BTW, be aware that whatever comes after header() is also executed unless you exit().

--
-- Álvaro G. Vicario - Burgos, Spain
-- http://bits.demogracia.com - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group
--
Aug 26 '05 #3
thanks for your help.
What is going on in mainpage.php? Are you sure the record insertion page
really does what you expect? Checked for errors?? mainpage.php does show the list of inserted records for a registered user.
The record is actually inserted for sure, as when I do a refresh, then the
new record is there.

If you start your scripts with the code below, you usually get some
hints ;)

ini_set('error_reporting', E_ALL);
ini_set('display_errors', TRUE);

Aug 26 '05 #4

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

Similar topics

18
by: Philipp Lenssen | last post by:
I have a problem doing a permanent redirect. It works only if I directly send the new location header (third line in sample below) but never in combination with sending a "301 Moved permanently"...
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...
10
by: Bob Garbados | last post by:
forgive my ignorance, as I'm new to php coming from a ms background... If I create a page named redirect.php and it's only content is: <?php header("Location: http://www.google.com"); ?>...
7
by: Monty | last post by:
Something odd is happening. Scripts on several sites that collect form data, save it to a DB, then redirect the user to another page are slowing to a crawl during the redirect using the header()...
6
by: G*rd*n | last post by:
I have been using the HTTP "Location" reponse header to direct a symbolic request to a CGI program to an actual URL/file. For example, let us suppose the CGI program's table indicates xyz ->...
3
by: maya | last post by:
yes I know, this has been asked many times, but I don't quite the answers: usu. answers are to put the redirect code -- in my case $URL =...
12
by: Jerim79 | last post by:
I have created a verification script to verify information and redirect the customer to the appropriate error page. For example: if ($FName=""){ header('Location:/verify_fname.htm'); } else{...
5
by: One | last post by:
Hi guys - I have a problem after a client clicks a Confirm button on a form - the form processes the data, inserts into a database, and then redirects using header Location. I have tested this...
5
by: 2291980 | last post by:
Hello can any body tell me the dff between function redirect($url) { echo "<script>"; echo "window.location='".$url."'"; echo "</script>";
4
by: Call Me Tom | last post by:
I was looking at an application with the following code snippet: ob_start(); session_name('foo'); session_start(); if (!$_SESSION) { header("Location: http://" . $_SERVER . dirname($_SERVER)...
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
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...

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.