Javeria Habib Javeria Habib - 5 months ago 10
PHP Question

Redirecting a page automatically in PHP

I want to redirect a page automatically in PHP

Logout.php:

<?php
include "base.php";
$_SESSION = array(); session_destroy();
?>
<meta http-equiv="refresh" content="=0;URL=index.php" />


Where base.php calls the database and starts the session:

<?php
session_start();
$dbhost = "localhost";
$dbname = "login";
$dbuser = "root";
$dbpass = "";
mysql_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error());
mysql_select_db($dbname) or die("MySQL Error: " . mysql_error());
?>


When pressing logout, I am not getting back to
index.php
.

Answer

This should work, you had an extra = before 0:

<meta http-equiv="refresh" content="0;URL=index.php" />

Linky https://en.wikipedia.org/wiki/Meta_refresh

Comments