I want to save names entered from a form with SESSION_START (); in php.
But I can only show the last name entered, what should I do? An array?
File index.php:
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Sesiones</title>
</head>
<body>
<form name="usuario" action="sesion.php" method="post">
<label>Nombre: </label><input type="text" name="nombre">
<br><br>
<input type="submit" name="BEnviar" value="Enviar">
</form>
</body>
</html>
File sesion.php:
<?php
SESSION_START();
$nombre = $_SESSION['nombre'][] = $_POST['nombre'];
echo "<ul>
<li>$nombre</li>
</ul>";
echo "<br><br>";
echo "<a href='index.php'>Volver index</a> <br>";
echo "<a href='cerrar.php'>Cerrar Sesión</a>";
?>
File close.php:
<?php
SESSION_START();
SESSION_UNSET();
SESSION_DESTROY();
echo "Sesion Cerrada correctamente <br>";
echo "<a href='index.php'>Volver index</a>";
?>
Thank you!