I'm trying to use sessions for learning purposes but it's not working. I got a login page which passes by POST "uname" and "passw" to this page:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<?php session_start(); ?>
<head>
...
if($_POST['uname']=="admin" && $_POST['passw']=="correctpassword"){
$_SESSION['login']="ok";}
if($_SESSION['login']=="ok"){
echo "<p>Logged in</p>";
} else {
echo "<p>Nothing</p>";
}
...
</html>
And it works until here. Then when I pass on another page:
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<?php session_start(); ?>
<head>
...
if($_SESSION['login']=="ok"){
echo "<p>Logged in</p>";
} else {
echo "<p>Nothing</p>";
...
</html>
and here it doesn't work.
I'm working on MAMP and Safari.
Can someone help me please?