Good afternoon.
I'm trying to create a form whose data will be stored in an array and should be displayed on another page when people's records are finalized. I'm trying to do this with SESSION, however, I do not think I'm getting the shape data into the vector. The data page does not display the data.
My Page 1:
<?php
session_start();
$aluno = array();
$_SESSION['cadastro'] = $aluno;
?>
<form action="cadastroS.php"method="POST">
<input type="text" name="nome" placeholder="Nome Completo"></br>
<input type="number" name="ra" placeholder="RA"></br>
<select name="gender">
<option value="Masculino">
<option value="Feminino">
<option value="Outro">
</select></br>
<input type="number" name="idade" min="1" max="99" placeholder="Idade"></br>
<input type="text" name="endereco" placeholder="Endereço"></br>
<input type="tel" name="telefone" placeholder="Telefone"></br>
<input type="email" name="email" placeholder="email"></br></br>
<input type="submit" name="cadastrar" value="Cadastrar">
</form>
<?php
if(!isset($_SESSION['cadastro'])){
array_push(
$_SESSION['cadastro'],
$_REQUEST['nome'],
$_REQUEST["ra"],
$_REQUEST["gender"],
$_REQUEST["idade"],
$_REQUEST["endereco"],
$_REQUEST["telefone"],
$_REQUEST["email"]
);
}
?>
page 2 (view people registered):
<?php
session_start();
foreach ($_SESSION['cadastro'] as $key => $value) {
echo $key .':' . $value, '<br>';
}
?>
Does anyone know what it can be?