473,230 Members | 1,490 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,230 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 2913
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: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.