Salve a tutti,
ho uno strano problema con le sessioni (oppure sono io che "non so fare" )
In questa pagina session1.php e' tutto ok
codice:
<?php
session_start();
$_SESSION['username']="Riccardo";
if (isset($_SESSION['username'])) {
echo "Benvenuto ".$_SESSION['username'];
}
?>
<html>
<head>
<title>test sessioni</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</p>sessioni2</p>
</body>
</html>
in quest'altra pagina sessioni2.php
codice:
<?php
session_start();
echo $_SESSION['username'];
?>
<html>
<head>
<title>test sessioni</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>
mi viene fuori il seguente errore
Notice: Undefined index: username in c:\inetpub\wwwroot\prova\sessioni2.php on line 3
Naturalmente sono sotto windows
win2000 server (tutti i service pack e patch vari)
iis5
PHP 4.3.7