Is there any other function in PHP that can be used for redirecting a page

I use the following

``header ("location: index.php");``

But it generates the following error:

``Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at c:\program files\easyphp1-8\www\admin-right-nav.php:5) in c:\program files\easyphp1-8\www\admin-right-nav.php on line 6``

Is there any alternative in php?

3
Contributors
3
Replies
4
Views
11 Years
Discussion Span
Last Post by sepedatua

Actually this is my code

``````<?
session_start();

echo "Logging out ".\$_SESSION['userid'];

?>``````

I get the error

``````Logging out admin
Warning: Cannot modify header information - headers already sent by (output started at c:\program files\easyphp1-8\www\logout.php:3) in c:\program files\easyphp1-8\www\logout.php on line 6``````

Well i use header function and it works good

Try:

``````<?
session_start();
header("Location: tussu.php"); //or (*)
echo "Logging out ".\$_SESSION['userid'];
?>``````

(*)

``header("Refresh: 5; URL:http://www.domain.com/path/to/tussu.php");``

5 <= this will show your "Logging out ".\$_SESSION" for 5 seconds.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.