<?php
session_start();
error_reporting(E_ALL);
$id = $_SESSION["id"];
$name = $_SESSION["name"];
$surname = $_SESSION["surname"];
if (!empty($id)) {
echo "<div id=\"user\">";
echo "<h4>Utente: $name $surname | <a href=\"http:/...\">Logout</a></h4>";
echo "</div>";
}
?>
Problem:
Notice: Undefined index: id in... on line 4
Notice: Undefined index: name in ... on line 5
Notice: Undefined index: surname in ... on line 6
So I try:
<?php
session_start();
error_reporting(E_ALL);
if (!empty($_SESSION["id"])) {
echo "<div id=\"user\">";
echo "<h4>Utente: $_SESSION["name"] $_SESSION["surname"] | <a href=\"http:/...\">Logout</a></h4>";
echo "</div>";
}?>
But:
Parse error: syntax error, unexpected '"', expecting T_STRING or T_VARIABLE or T_NUM_STRING in ... on line 7
Why?