Julian Buscema
Julian Buscema

Reputation: 7

Webpage redirect not working properly

I'm making the index.php page for my website and I've come across multiple errors on line 13 of the code below, but I have fixed the majority of them. I've tried adding

</meta>

and even the ; , after http-equiv="refresh"

Here's my code:

<?php


session_start();


$username = $_SESSION['username'];

$password = $_SESSION['password'];

if(!$username && !$password){

echo "You will be redirected to login in 5 seconds! (<meta http-equiv="refresh"; content="5; URL=login.php"></meta>)";

}else{

echo "Welcome , ".$username."! (<a href=logout.php>Logout</a>)";

}



?>

Upvotes: 0

Views: 48

Answers (1)

jay temp
jay temp

Reputation: 1205

the problem is the double quote inside your double quote.. escape them using \ or use single quote instead.

echo "You will be redirected to login in 5 seconds! (<meta http-equiv=\"refresh\"; content=\"5; URL=login.php\">)";

Upvotes: 1

Related Questions