473,386 Members | 1,830 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,386 software developers and data experts.

Warning: Cannot modify header information

142 100+
hi,

For some reason the URLS won't redirect, it has worked but now it does not want to work. I even got the script from scratch again but still it does not want to work.

I get the following error:


Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\volvo\secure\log10.php:2) in C:\AppServ\www\volvo\secure\log10.php on line 5

[PHP]

<?php
$d=date("1");
if ($d=="1")
Header("Location: http://www.google.com");
elseif ($d=="2")
Header("Location: http://www.yahoo.com");
else
echo "Have a nice day!";
?>

[/PHP]

I know of the $d=date("1"); but just copied the script because I saw it work.
Dec 14 '07 #1
3 1017
webandwe
142 100+
I see on some hosting servers it works and other servers it does not work.

Any advice?
Dec 14 '07 #2
nathj
938 Expert 512MB
hi,

For some reason the URLS won't redirect, it has worked but now it does not want to work. I even got the script from scratch again but still it does not want to work.

I get the following error:


Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\volvo\secure\log10.php:2) in C:\AppServ\www\volvo\secure\log10.php on line 5

[PHP]

<?php
$d=date("1");
if ($d=="1")
Header("Location: http://www.google.com");
elseif ($d=="2")
Header("Location: http://www.yahoo.com");
else
echo "Have a nice day!";
?>

[/PHP]

I know of the $d=date("1"); but just copied the script because I saw it work.
Hi,

I think the problem is the spaces in the code. This can be read as outout which then means that headers can't be set. Try the code without the indentation.

Normally I'm all for indentation, it makes life easier when maintaining code but in this case I think it means the code won't work.

Give it a try and see if it solves the problem.

Cheers
nathj
Dec 14 '07 #3
Markus
6,050 Expert 4TB
hi,

For some reason the URLS won't redirect, it has worked but now it does not want to work. I even got the script from scratch again but still it does not want to work.

I get the following error:


Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\volvo\secure\log10.php:2) in C:\AppServ\www\volvo\secure\log10.php on line 5

[PHP]

<?php
$d=date("1");
if ($d=="1")
Header("Location: http://www.google.com");
elseif ($d=="2")
Header("Location: http://www.yahoo.com");
else
echo "Have a nice day!";
?>

[/PHP]

I know of the $d=date("1"); but just copied the script because I saw it work.
That script works fine for me..
Dec 14 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: None | last post by:
Hello, I am a total newbie to PHP and programming in general. I am playing around with a PHP / MySQL shopping cart script which I found at...
3
by: Greg Scharlemann | last post by:
Does the redirect statement: header(Location:"http://www.newpage.com"); need to come before certain statements? I've setup a login page and try to redirect a user once they have logged in...
19
by: lawrence k | last post by:
How can I find out where my script is outputting to the screen for the first time? My error logs are full of stuff like this: PHP Warning: session_start(): Cannot send session cache...
4
by: kempy535 | last post by:
Hi I get this error code when I try to run my login script. Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\Apache2\htdocs\Rising...
5
by: nasse | last post by:
I am getting the following error msg whenever I try to login. I tried to turn my output_buffering = On in my php.ini but is not working for me. Would you please help me: Warning: Cannot modify...
8
by: mcserret | last post by:
I know this is a recurring problem that has been addressed here before, but even after reading all that has gone before, I am still stumped. I have a form that is designed to send data to a PHP...
2
by: smartic | last post by:
I'm having problem with header redirection that is my code: <?php header("location:Redirecting.php"); exit; ?> //Then the HTML It give me an error
3
by: mrosado | last post by:
Hi everybody, I have this problem.- The browser launch this two errors: Warning: session_start() : Cannot send session cache limiter - headers already sent (output started at...
3
by: gubbachchi | last post by:
Hi, I have written php code to retrive the image from mysql and display it on the webpage. Here is the code <?php require_once("DBConnect.php"); $gotten = @mysql_query("select user_photo from...
10
by: jessica87 | last post by:
hi there, i m using this coding to retrieve the file from database so that my user can download the file... <?php if (!isset($_GET)) die('Invalid Parameter'); include...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
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...

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.