PHP Header() Function Not Working

Nov 20, 2007

I have the following :

//¬ Date¬ in¬ the¬ past
header("Expires:¬ Mon,¬ 26¬ Jul¬ 1997¬ 05:00:00¬ GMT");
header("Cache-Control:¬ no-cache");
header("Pragma:¬ no-cache");


View 2 Replies


Header() Function Not Working?

I've got a problem with a header function using Location. I tracked it down to, that echoing content before header doesn't work properly. Does the order of code causes this problem, or the order of execution?

I have seen ob_start() suggested but I got this understanding that it is bad form.

View 7 Replies

Header (Location) Function Not Working?

However, I am following the book 'Build Your Own Database Driven Website Using PHP & MYSQL' by Kevin Yank.I have followed the book up until page 147 but I have a problem. This page lists the complete index.php code for displaying jokes from a database, adding jokes and deleting jokes:

if (get_magic_quotes_gpc())
function stripslashes_deep($value)


I can get the page to display the jokes list and even add a joke. It then returns to the jokes list (the purpose of including the header (location) function). BUT, when I try to delete a joke nothing happens, the page looks the same and all the jokes are still there. I check the database using MySQL Admin and nothing has changed. I initially had a problem getting the header(location) bit to work when adding jokes but deleting the following exit(); solved it. I have copied and pasted the complete code example into my own index file and it now works again with the exit(); now replaced.

View 2 Replies

Header Function Is Not Working In The Host Server

the header in my local server is working but in the hosted server is not!

PHP Code:

header('Location: step3.php');

View 18 Replies

Header Function Is Not Working In The Host Server?

the header in my local server is working but in the hosted server is not!

header('Location: step3.php');

View 5 Replies

Header Working On Localhost But Not Working Online?

with this



View 14 Replies

Header Function Redirect Argument Passing / Error Header('Location: ReservationConfirmation.php?confirmationNum='?

I want to redirect to some other page and pass multiple argument from header in PHP.I can pass one argument,but when i start adding more parameters it gives error.I think most probably there is something syntax error.But i can't get around it.

This is when i have one argument it works fine.

header('Location: ReservationConfirmation.php?confirmationNum=' . mysql_insert_id());

I want to add additional parameters here,but it gives error.

header('Location: ReservationConfirmation.php?confirmationNum='. mysql_insert_id()'&dtTimeSlot='$dtTimeSlot'&iTheatreId='$iTheatreId);

View 1 Replies

Header() Function - Warning: Cannot Modify Header Information

I have attempted using the code provided, but I consistantly get an error concerning the header() function found on the bottom on the script.

What am I not understanding about header information?
I always get this error:

Warning: Cannot modify header information - headers already sent by (output started at C:apacheApache2htdocsPHPupdateupdate.php:9) in C:apacheApache2htdocsPHPupdateupdate.php on line 71

Is the tutorial not correct? Because I've seen similar tutorials that put the header() function in similar places too.

Here is the code:....

View 3 Replies

Header Not Working In IE

im using the header function to set a redirect. it works fine in mozilla firefox however in IE it causes a "page cannot be displayed" error. PHP Code:

header("Location: xfire:status?text=test");

View 4 Replies

Header() Not Working?

I am using the header() function to forward the entire page to the browser.

The script submits a form from a sister site to my main site, but in the background, so it appears to the user they are still on the same site (apparently it brings down the google rating of both if submissions are made to other sites, plus it doesnt look as professional).

Basically, a connection is opened, headers sent, data returned, printed out. Header is used in case there are extra header tags sent out by the initial server, instead of just using echo.

The script works fine on my test server, however just a blank page is returned on their live server. Echo'ing the variable shows that the entire page IS there, just the header() wont send it to the browser.

View 2 Replies

Header Not Working

I stripped down everything I could. This problem only arises in i.e. I have a form, with an action set to login.php. In that login.php, I was checking the DB for the user, and using header to redirect. I was noticing in i.e. sometimes it'd follow the header, sometimes not. So now I stripped out my login.php to be just a header:

header("Location: mgm/base.php");

If I keep submitting the form, sometimes it will follow the header, sometimes not.

View 12 Replies

Download Header Not Working In IE

I try to give my script headers so the output text would be downloaded in
the client's browser and not displayed. But it doesn't work at all in my IE
6 and Opera.

header("Content-Type: application/octet-stream");
header("Content-Length: 5");
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment; filename="gamedata.txt"");
echo "hello";

I have an Apache 1 installed on my system, can it be that it is
misconfigured and sends the headers in a wrong way? How can i change this?

View 18 Replies

Header() Not Working Properly

I keep getting a "Headers already sent on line 20, blah, blah, blah" error and I don't see where I'm outputting information BEFORE the header in my 'if' statement. PHP Code:

View 7 Replies

Header Redirect Not Working

I am attempting to build a simple blog script into my webpage, everything is working fine, except, that the page will not redirect after it finished processing. I'm using header to redirect; however, I am not sending any output prior to the call, nor am I getting any sort of usefull error message.

The code is below. If anyone has any ideas I'd be glad to hear them, or if you have a better method for redirecting the user (similar to the way this board does it after a new post), that would also rock. BTW, I know that the whole file may not be relevent to the problem I am facing right now, but perhaps there is some output being sent and I am not seeing it, or any error related to it. Code:

View 6 Replies

Header Not Working On A New Server

$_SESSION["lingua"] = $_GET["id"];

this simple dont work on a new server, on a old one worked.

View 2 Replies

Header Redirect Not Working?

I'm developing a security system for a CMS but it appears that my redirect does not work.

I'm using sessions and I know that the session is being created since I did an echo on session_id().

<?php if($count==1)
print "logged in";
header('Location: edit.php');


What's wrong, and how do I fix it to redirect after the user is authenticated?

View 7 Replies

Setcookie Not Working With Header?

My code is below... When I comment out header('Location: .'); the cookie is set, otherwise it's not:

PHP Code:

if (isset($_POST['remember_me']))
setcookie('backstagepassword', md5($_POST['password']), time()+3600);
header('Location: .');

View 3 Replies

More Than One Header In Chrome Not Working?

Im using PHP to track the clicks of all mailto links by rewriting the mailto: to my script and then setting the header of the referring page. Initially I just had:


...but this has an undesirable effect in IE8: it opens 2 email windows. So, in my attempt to resolve that issue I am now using:

header("Status: 200");
header("Refresh: 0;");

This works fine in IE but not chrome. I threw the "status" in there hoping to solve the mystery. Other than detecting the browser and issuing different commands, what else could one do?

View 4 Replies

Iis - Header Status Not Working In Cgi

Setting the Status header is not working in PHP CGI. I am using PHP on the IIS webserver.

header('HTTP/1.1 404 Not Found');
header('Status: 404 Not Found');

View 1 Replies

Header: Location Is Not Working?

Here is my php:

$confirm = $_POST['confirm'];

View 4 Replies

Header Not Working With A Form Sent To Self?

at the beginning of the page, there is some code that should redirect to another page based on the button pressed:


View 1 Replies

Header() Not Working In Script

I have a basic form that inserts form data into a database. After it is successful, it echos a message that that the form was successful. Instead, I want to redirect to another page. This is a pure php page with no html in it.

Here is the code that works: Code:

View 4 Replies

Header (Location: ) Not Working On Web Server

I have a simple php page in which I use


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 8 Replies

Cookies Not Working With Header() Redirect

I'm using the cookie to store the user's session ID. After they login, they are redirected to the page (index.php) they are supposed to hit after logging in. Index.php checks to make sure that everything is in order and if there isn't a cookie with the right info it will dump them back to the login page.

The problem comes after the user logs I said, they are redirected after logging in; however, when I do this, index.php does not recognize that there was a cookie set. If I take out the redirect header() from the login page and just supply a link to index.php that the user must click after they login, everything works. From the php manual: Cookies will not become visible until the next loading of a page that the cookie should be visible for...A nice way to debug the existence of cookies is by simply calling print_r($_COOKIE);.

I think that this might be part of the problem, and that somehow the header() isn't being recognized as an actual "page load." Just for the record cause I know someone will proly ask, I have called print_r($_COOKIE);to see if the cookie is set and it is.

View 14 Replies

Include And Header(Location: ) Not Working Together

In php5 I am not able to use include funciton and header("location:""" together.

View 4 Replies

Header Not Working - If No Errors Does And Insert

In a script that looks for posted variables and then errors and if no errors does and insert. I have a problem with setting the page to forward.

If I use the header command:
header("Location: $u");

It does not work. However if I use meta refresh it does work:

print "<META HTTP-EQUIV="refresh"content="2;URL=http://localhost$u">";

The header command works properly on many pages.

I even tried an


after the header commant, but that does not work either.

View 1 Replies

Copyrights 2005-15, All rights reserved