-2
I am creating a contact list in php, and when I am sent all the data of the form for it to display to me, it displayed: 1, not my data that I entered.
<?php session_start(); ?>
<!DOCTYPE html>
<html>
<head>
<title>Adicionar contatos</title>
</head>
<body>
<h1> Adicionar Contatos </h1>
<form>
<fieldset>
<legend>Adicionar contato</legend>
<label>
Contato:
<input type="text" name="numero">
Nome:
<input type="text" name="nome">
Email:
<input type="text" name="email">
</label>
<input type="submit" name="Cadastrar">
</fieldset>
</form>
<?php
$lista_contatos = array();
if(isset($_GET['numero']) && isset($_GET['nome']) && isset($_GET['email'])){
$_SESSION['lista_contatos'][] = $_GET[numero] && $_GET[nome] && $_GET[email];
}
if(isset($_SESSION['lista_contatos'])){
$lista_contatos = $_SESSION['lista_contatos'];
}
?>
<table>
<tr>
<th>Contatos</th>
</tr>
<?php foreach ($lista_contatos as $contatos) : ?>
<tr>
<td><?php echo $contatos; ?></td>
</tr>
<?php endforeach; ?>
</table>
</body>
</html>
Could you be more specific? I don’t understand your problem. Ask a [tour] to create a good question.
– Renato Junior