header problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
prasadharischandra
Forum Commoner
Posts: 57
Joined: Thu May 09, 2002 2:19 am
Location: sri lanka
Contact:

header problem

Post by prasadharischandra »

i used header(location:index.php");
but it didn't redirect to index error massages is
Warning: Cannot add header information - headers already sent by (output started at /web/disk1/virtual/ctrlshops.com/accounts/ctrltrack.com/htdocs/expo/edit_user.php:8)
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Quotes?

Post by icesolid »

I looked at the code you entered above, and you put:
include(location:index.php");
The code should be:

Code: Select all

<?php
header("Location: index.php");
 ?>
Also, you must enter the header(); function before any other code in the document, such as any includes and etc. You can Visit the PHP documentation page on the header(); function here (http://www.php.net/manual/en/function.header.php) for more information on the header(); function.
prasadharischandra
Forum Commoner
Posts: 57
Joined: Thu May 09, 2002 2:19 am
Location: sri lanka
Contact:

Re: header problem

Post by prasadharischandra »

same problem
icesolid
Forum Regular
Posts: 502
Joined: Mon May 06, 2002 9:36 pm
Location: Buffalo, NY

Hmhm...

Post by icesolid »

The header(""); code must be entered before any other code on the page. Are you sure it is the first line of code.

Make sure it looks like this:

Code: Select all

<?php 
header("Location: index.php");
?>
If that still does not work. Make a new PHP document, and enter only these lines of code in the document:

Code: Select all

<?php 
header("Location: index.php");
?>
Then save and upload it and access the file, and if you are redirected right to index.php, then there is something else wrong in your PHP code.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Post Reply