473,738 Members | 3,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

header location and redirect

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

header("Locatio n: http://$SERVER_NAME/mainpage.php?SI D");

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?SI D);

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 2954
On 2005-08-25, Bob Bedford <be******@notfo rspammershotmai l.com> wrote:
From my record insertion page I do, in some cases, this:

header("Locatio n: http://$SERVER_NAME/mainpage.php?SI D");

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('displa y_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('displa y_errors', TRUE);

Aug 26 '05 #4

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

Similar topics

18
4350
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" first (second line below). Unfortunately my server is shielding error messages from me (and I don't have access to the PHP.INI). ------- Sample ------- <? header("HTTP/1.1 301 Moved permanently"); header("Location: http://www.example.com");
10
5668
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 header('Location: ...) jump to page A on success or falls through to the jump to page B. This is the code: if ( mysql_query( 'LOCK TABLES tableX WRITE', $link ) ) { mysql_query( $q, $link ) ; // store the record
10
9372
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"); ?> Should it not redirect to www.google.com? I can't get the header() function to redirect. I'm trying to take an online reservation... the customer fills out
7
2880
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() function. For example: header("Location:member.php"). I tried changing the header() command in a few ways: header("Location:/member.php"), header("Location:./member.php"), header("Location:http://www.site.com/member.php"). But none of these made...
6
2887
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 -> /this/that/the.other.thing.html, then redirect.cgi?xyz results in the page /this/that... being sent. redirect.cgi is usually in another directory than the page it is to supply. This works fine as far as it goes. A problem arises when the actual...
3
1918
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 = "out.php?msg=selected+records+have+been+deleted+from+the+database."; header("Location: $URL"); BEFORE any HTML output (does this include 'echo' output's?) but: if, like in my case, for example, I delete data (passed in req)
12
1901
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{ if ($LName=""){ header('Location:/verify_lname.htm'); }
5
6136
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 on two different Linux/Apache servers. One works perfectly, the other takes about 90 seconds to redirect. Has anyone seen this issue before ? It uses a function like this :
5
1808
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
1444
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) . "/index.php"); ob_end_clean(); exit();
0
8968
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
9473
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
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...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8208
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
4569
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
4824
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
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 we have to send another system
3
2193
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.