0
I couldn’t figure out why the information doesn’t save in the database I created on Phpmyadmin.
Follow the codes below:
index.html
:
Name Address Email
</body>
======================================================
cadastroUsuario.php
:
<?php
$nome = $_POST['Nome'];
$endereco = $_POST['Endereço'];
$email = $_POST['Email'];
$server = 'localhost';
$user = 'Saulllofelipe';
$pass = 'Shika9573';
$db = 'cvdd';
$conn = mysqli_connect($server, $user, $pass, $db);
if ($conn->connect_error)
echo "Erro<br>";
else
echo "Conectado com sucesso<br>";
$sql = "INSERT INTO alunos(Nome, Endereço, Email) VALUES ('$nome', '$endereco', '$email')";
if($conn->query($sql))
echo "Seja bem vindo $nome<br>";
else
echo "Erro ao salvar<br>";
?>
Someone can show me the error and how to solve?
Address fields are with ç? Place a semicolon at the end of the query. These may be the problems
– Lucas Augusto Coelho Lopes
Post the html tbm.
– Lucas Augusto Coelho Lopes
Instead of putting
echo "Erro ao salvar<br>"
, placeecho $conn->error;
. This way you will know precisely why you have not saved.– Andrei Coelho
Then the HTML file: <html> <meta charset="utf-8"> <body> <form method= "POST" action="creatureUsuario.php"> Name<input type="text" name="Name"> Address<input type="text" name="Address"> Email<input type="text" name="Email"> <input type="Submit" value="Send"> </form> </body> </html>
– Saulo Felipe
People show up this message, but I can’t identify the error.
– Saulo Felipe