Header('Location:') Jump Ignored?
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
$ID = mysql_insert_id( $link ) ; // save the new id
if ( mysql_affected_rows($link) == 1 )
{
unlock_tables() ;
$_SESSION['ErrMsg'] = 'New ID is ' . $ID ;
header( 'Location: PageA.php' ) ;
$_SESSION['ErrMsg'] .= ' Error: ignored jump' ;
}
else // the store failed
{ error handling }
}
// second chance (for debugging) to do the right thing
header( 'Location: PageA.php' ) ;
$_SESSION['ErrMsg'] .= ' and it ignored it AGAIN!' ;
// and we shouldn't get here at all -- but we do!
header( 'Location: PageB.php ) ;
Unfortunately, as I know from the telltales I stuff into session, the
store works but the interpreter ignores both header calls that would
jump to A and finally jumps to B instead. Unless I'm more tired than
I'm aware, or more ignorant, this doesn't make sense.
View Complete Forum Thread with Replies
Related Forum Messages:
Header - Jump Menu Does Nothing In IE
I have a php header and php footer that are being called into my content pages. In the php header, I have a jump to menu system. The jump to menu works great in Firefox, however, the jump menu does nothing in IE. Have any of you experienced problems with jump to menues in php headers and whatnot?
View Replies !
Header Location - Cannot Modify Header Information Headers Already Sent By
I am trying to do a header location. but it is messing up. it is giving me the following error Cannot modify header information headers already sent by (output started at /home/content/i/n/n/****/html/***/connect2.php:19) I am using the following code if($_SERVER['HTTP_REFERER'] =="http://profileawareness.com/forums"){ }else{ header("location: http://profileawareness.com/denied.html"); }
View Replies !
Header CSS Location
I've created header/footer files, and included them in all the pages of my website. My problem is that in the header file, I have link href="css/default.css" rel="stylesheet" type="text/css" which doesn't apply for each page, since I have some pages in folders for organizational issues. Is there a way to make that reference dynamic somehow? I don't even know if my thinking is correct. I've seen $_SERVER['DOCUMENT_ROOT'] been used, but tried it and received errors. I'm not sure if I set it up correctly.
View Replies !
Header('location:$url);
i was just wondering if i made a a php page using header('location:$url); and i just want get a certain part or the page what says the solution is: blah. then store in a variable and then print it back out or do i have to use the file_get_contents but if i use file_get_contents i have to use 3 cookies
View Replies !
Location Header
is it possible to send data via location header like so <?php $search = 'random'; $location = 'mysite.com/myfile.php?search='.$search; // mysite.com/myfile.php?search=random header('Location: $location'); ?>
View Replies !
Header Location
PHP Code: <? require('dbconection.php'); $id_producto = $_GET['id_producto']; $id_ses = $_GET['id_ses']; $borrar = mysql_query("DELETE FROM don_carrito_temp WHERE id_ses='$id_ses' AND id_producto='$id_producto'"); if ($borrar){ Â Â Â Â header("location: index.php?id_ses=$id_ses"); } ?> and after I call it. it shows me this: " CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: "
View Replies !
Header Location
i use php5, sometimes i see that header(location:index.php); takes me to a blank page, i have never experienced that in linux. no matter what the code before the header contains, it just takes me to a blank page. if i put javascript location.href with the same path it works fine (not such a good idea. system info: Windows NT SERVER9 5.0 build 2195. PHP Version 5.1.2.
View Replies !
Using Header Location
I have a php script that does some form input validation. As it verifies each field if the field has incorrect data, it appends an error message to an $error array. E.g. if (an_error = true) { $errors.="<tr><td>You have note entered a surname. This is mandatory date of birth incorrectly.</td></tr>";
View Replies !
Header Location Newbie
I'm doing a relative URL redirect using this: <? header("Location: ../research/index.php?current=34"); ?> which works fine, except it redirects to the .org.uk version of my site rather than the .org version. Where does it get this from ?
View Replies !
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 ?
View Replies !
Header Set-cookie + Location
I have tried using this code, but it won't work for me: <? header ("Set-Cookie: hit_id='$id'nLocation: <A HREF="http://www.mysite.comnn");" TARGET=_blank>http://www.mysite.comnn");</A>?> now on my own pc (win98) it works, but on my site nothing happens any ideas??
View Replies !
Php - Header Location Very Slow
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 : tep_redirect(tep_href_link(FILENAME_CHECKOUT_SUCCE SS, Ƈ', 'SSL')); function tep_redirect($url) { if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL } } header('Location: ' . $url); tep_exit(); } In my tests - I'll receive the confirmation email *beofre* I see the success page in the browser!
View Replies !
Location Header From Class
I try to call a Location header from an included class. It didn't work. If I didn't include but write the code of the class in the page everything is fine. So I thought it is an include problem but the instantiation of the class is even when included working. A print_r shows me the type of the class. What else can be a problem?
View Replies !
Help With Variables In Header Location
this is probably very easy to sort but I want to do the following:- header( "Location: subscribe_form.php?name='.$_GET['name'].'&email='.$_GET['email'].'"); but this pulls up the error:- Parse error: parse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/httpd/vhosts/promotingmusic.co.uk/httpdocs/test/subscribe.php on line 11 the above being line 11. How would I go about encoding the URL properly. The reason I am doing this is that I am using a form that is being validated via another script and if there is a problem I wish to fiorward them back to the form with it pre filled in. Also is this the correct method for doing this.
View Replies !
Redirect- Header.Location
how do I redirect from one page to another in PHP? I am novice, so keep it simple please.for example if(a>b) { header.Location("http://a.html"); } else { header.Location("http://b.html"); } Is this right code?
View Replies !
Header('location: ') Problem..
when i use header('Location : example.php") to redirect...in some pages it works fine and in others it gives error like header already started in some line..cant send header.
View Replies !
Header(location) & $_POST
On my index.php page I have a form which forwards to another page, we'll say page1.php - on page1.php it enters the information into the database and then I have: header('location:index.php'); Once it returns to index.php I'm finding that if I click refresh, the browser does that whole "The page you are trying to view contains POSTDATA. Any action performed etc etc..." I don't understand why tho? If it was an include I would understand, but I didn't think this would happen in a header function? Can someone explain or suggest another way (other than body onload redirecting)?
View Replies !
Header Location : Site.php
I have a login box with a username and password. When the user enters the details, they are logged into the task they are assigned to. the idea is... ->check username and password in db ->this will give me the task they are assigned to if username&password=db... header("location: task.php".session_id()); problem is that this will not pass the username and password to the other site. But i need to pass the username and password vars, can this be done and any ideas on how?
View Replies !
Header (Location: 2 Pages?)
I have a page which once you confirm with a button on a form posts info to the same page, turns the post variables into several lines of sql inserts and updates, and executes the queries. I need to make this page return to another summary page which is easily enough done using the header command. However I also need it to open a second page as a popup, which if it was a simple link i would just add a target tag to the href.
View Replies !
Header(Location) Query
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 lower half of the frame, header("Location: lower.php TARGET='lowframe') with out the Target setting, it opens lower.php in the upper part (ie it replaces its self), but with the TARGET statement it can't find the file. Is this do able? or is the fact that the TARGET= is HTML which messes the header up.
View Replies !
Header(location) Problem
i am trying to forward a user after processing his login information. The header doesn`t seem to be changing from the processedlogin page. Here the sequence to enter the member area: login.php > processedlogin.php > mp1.php the code for the page is as follows: Code:
View Replies !
Send A Location Header
I have a frame in which there is a PHP page. Is there any way to redirect from this page to another page which will display in the main window, not just the frame which the PHP file is in.
View Replies !
Header (Location: $var) Loops In IE
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['var'])) && ($name='valid')){ // insert some data into MySQL. $location = 'page2.php?name='.$name; header(sprintf("Location: %s",$location)); exit(); } FireFox redirects the user to page2.php as planned. But IE6 loops back to page1.php (refreshes twice on most occasions). Any ideas?
View Replies !
Header (Location: ) Not Working On Web Server
I have a simple php page in which I use header("Location: http://www.example.com/"); to redirect the user to another php page. The php script works on my local machine but when I upload it to the web server for hosting the redirection does not work. Instead on one server it gives the standard header error Warning: Cannot modify header information - headers already sent by ....... while on the other server, I dont see this error but it also does not redirect just refreshes the page when I click the Submit button. Does anybody know how can i resolve this?
View Replies !
Header - Location - & META Refresh
Im basically wanting a 'login' page & logout page - Im almost finished with it, & have a query re the above two commands... (One is PHP, & one is HTML) - Basically, I want to set the cookies etc.. - wait 3 seconds with a small text, for the person to read, - & then refresh to the next section/page... Ive looked on the http://nz.php.net/header section, however the command to go to a different "location" doesnt seem to have a 'pause' section.. IE - wait 3, 5, 10 etc etc seconds - & then refresh - The 'location' command is instantaneous... is this correct ? If I "needed" a pause section, - I'll have to use the META REFRESH command (which I understand - is NOT 100% supported by all browsers.... ?? (The PHP 'header' command is 100% effective - right)....- not affected by the browser type (I know that part :) ) I'll use the instantaneous PHP 'header' command for now - Just curious if the above thinking is correct...
View Replies !
Redirecting With Header(Location:blah
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 issue a "header(Location:/myscript.php?key1=value1&key2=value2);" the redirect happens just fine but the url in the address field keeps the previous url instead of the url I passed in the header call. This seems to happen only with I.E. Netscape does update the url correctly. I've also noticed that if I include the full path (location:http//blah) it works. So, can anyone tell me how to force an address field update using a relative url using an I.E. browser?
View Replies !
Passing Vaules Through Header Location?
I'm trying to pass an ID value to another page using Header Location. $id = $row['aff_id']; header("Location:aff_tools.php?id=".$id.""); However, its not showing in the address bar on the next page. It jsu shows: aff_tools.php?id= I use this link all of the time, but it does not seem to work with the header. Any ideas I have also tryed: $id = $row['aff_id']; header("Location:aff_tools.php?id=$id"); AND $id = $row['aff_id']; header("Location:aff_tools.php?id='.$id.'");
View Replies !
Header(location: Page.php?error=something)
i have a login form that looks like this: PHP Code: <?php if(!isset($_POST['submit'])) { Â Â //form here } else { Â Â //code here } ?> now in the code i check for errors in the fields like usuall. If an error is found, like the text in the password field is to short, then it need to be redirected to the login page with page.php? error=something.but i cant use header(location: page.php?error=something) because headers already send by. Also i dont want the code in a seperated file for some reasons. And i want the error be displayed at the login form. how can i do this?
View Replies !
Header(Location ) And Mysql Probelm
My setup is PHP 4.3.3, mysql 3.32 running under RH 9 (2.4.20-8smp). I have a login script (login.php) that once login credentials have been verified the script sets a few session variables and then redirects the browser to a second page. This second page has a script that queries a mysql database. Code:
View Replies !
Continue Calculation After Header(location)
My web server runs on apache/Linux. It collects data from users (using a form), process it, does some calculations using external scripts and programs. The output is displayed using links given from an HTML which is created during the php's run. The Output HTML is created at the very beginning, and includes a "refresh" tag. During the processing and calculation, messages are written to that HTML, so the user is updated with the server's progress. Code:
View Replies !
Post Vars Vs Header Location
Page1.php has a form with method=post to join site as buyer or seller as normal, premium or gold membership. Page2.php has another form with method=post to pick 6/12 month membership price, whether you want recurring billing and Credit Card data. Page3.php processes the CC transactions from the post data. Everything is comes in fine. In simple terms my code is: $response1 = curl_exec() //first payment transaction $response2 = curl_exec() //for the ARB Automatic Recurring Billing. if($debug) echo $response1 . $response2; //both good $_POST['x_response'] = $response1 //or 2 or anything if(!$debug2 ) header("Location: page4.php"); else header("Location: page4.php?x_response=".$response1); Page4.php does not get the HTTP_POST_VARS nor the $_POST['x_response'] nor $_REQUEST Authorize.net shows both transactions as good.
View Replies !
Changing Pages: Header('location') Or PHP Require()?
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.
View Replies !
Location Header WORKING After Content Written...why?
As far as I know, http headers should not work after content has been written. This is how my production box is working, but for some reason on my dev box I was getting away with a location header after content (some debug notes) was written. Just to be sure, I threw a die() in right before the header('Location: '...) call, and sure enough there was the same stuff on screen that the live box is choking on. So does anyone have any ideas on what I might have set that allowed me to get away with this? It's not a capability I enjoy. Environment is Apache 2 on Redhat AS3.
View Replies !
Problem With Header("Location:.. Function
I am trying to use the following function: header("Location: http://www.mysite.co.uk/home/update/index.php"); ....but getting the following error: Warning: Cannot modify header information - headers already sent by (output started at /data/httpd/VirtualHosts/www/htdocs/home/update/index.php:12) in /data/httpd/VirtualHosts/www/htdocs/home/update/index.php on line 124 Is there any reason why I am getting this error? One concern of mine was that the header function was not at the top of the page (line 1), does this matter? I need this command to run a series of statements and depending on specific conditions, redirect the user to another page.
View Replies !
Sending POST Urls From A Header(location);
I have a header location to redirect you.. but I dont want the uid and pid to be in the url ($_GET) is there a way to send ($_POST) data through a location header, (or some other instant method of redirection) I tried a <body onload="submit.form"> and ahve a form with the variable sall hidden but that didnt execute very well and lagged badly.
View Replies !
Check Filename -> Header: Location Error?
I wrote this snippet to include in some functions & inclusion files, so that if the script is used in any page but the one intended, the user is moved to another domain. What is wrong in this script? When I run it, and call the script directly, I get errors in the rest of the file, saying it cannot use functions (Which is normal, since all these are not set, they get set in the masterpage: index). Shouldn't it evaluate this script, and then not bother about the rest of the page when the index is not found? Code:
View Replies !
Header Location Redirect Interfering With Script -
A script i'm working on is behaving real strange. It is more or less the same as dozens of others that work aok. Info is posted from one script to another, the second script does some work (nothing too taxing, just checks the input and updates/moves a couple of files) then redirects to the first script. Code:
View Replies !
Problem With $_SESSION And Header("Location:...
Session variables set before a header("Location: whatever") are not being written. And yes, before the header() call, I have session_write_close() but the result is the same. This problem is with PHP 4.3.10 on my hosting providers' server (and obviously I wouldn't like the hassle of changing hosting providers), but it works OK on some other PHP 4 and PHP 5 servers.
View Replies !
Header("location: $url) Problem With Internal Links
I asked about this problem like 6 months ago but didnt reach a solution and i ignored it, but now while writing some script i needed to use it again! So the problem is that this line down works fine with firefox but in IE6 & 7 it just goes to the url ignoring anything from # till end so it just goes to the url without jumping to the internal link but if i manually added the internal link in the url.. it will normally go to it! but the strange thing is that same line worked in other php files on same server! PHP version 5.1.2 header("Location: h**p://www.mysite.se/somefile#a"); also doesnt work in any of the following cases! ----------------------------------------------- header("Location: h**p://www.mysite.se/somefile.htm#a"); ----------------------------------------------- $h = '#a' $url = $_SERVER['HTTP_REFERER'].$h; session_write_close(); header("Location: ".$url); exit; --------------------------------------------- But all works in firefox!
View Replies !
Check Where Output Starts: Header(location:) Issue
I am upgrading a CMS I wrote a long time ago. part of the upgrade is an overall include page which store basic stuff like contact details, paths, scriptnames. I have run into the problem that I get a 'Cannot modify headers, headers already sent. Output started by include_inc.php:1 in page.php line X' error message, when trying to redirect people after processing, using header(location. I assume that the include_inc.php:1 means that it should be on line 1 of my include that the output started? Odd thing is.. I cannot find any output: The include starts of with <?php, then a whole bunch of variable & constant declarations, then ?> and no whitespace before or after. Also, if I add echo "--"; at the top and end of the include file, nothing shows up in between. Anybody know a way to get a better idea where the output may have started?
View Replies !
Aren't Session Variable Preserved Using "Header('Location: Xxx')"?
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 page I don't get any session variable values! BTW, I used a relative location in the Location header, not an absolute URL. The behavior looks like it started another session, but it should not have.
View Replies !
|