Javeria Habib Javeria Habib - 1 year ago 60
PHP Question

Redirecting a page automatically in PHP

I want to redirect a page automatically in 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:

$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

Answer Source

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