5
I created a registration system, but when I click the sign up button appears the message "Could not insert record:"... Someone can identify this error as I have so far been unable to identify it. Follow my code below.
php.
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Sistema de cadastro</title>
</head>
<body>
<form name="signup" method="post" action="cadastrando.php">
nome: <input type="text" name"nome" /><br /><br />
sobrenome: <input type="text" name="sobrenome" /><br /><br />
e-mail: <input type="text" name="email" /><br /><br />
senha: <input type="password" name="senha" /><br /><br />
<input type="submit" value="cadastrar">
</form>
</body>
</html>
registering.php
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8">
<title>Cadastrando...</title>
</head>
<body>
<?php
$servidor = 'localhost';
$usuario = 'root';
$senha = null;
$banco = 'dbcadastro';
$conexao = mysqli_connect($servidor,$usuario,$senha,$banco);
// verifica a conexao
if (mysqli_connect_errno())
{
echo "Erro ao conectar: " . mysqli_connect_error();
}
?>
<?php
if (isset($_POST["submit"])) {
$nome = $_POST['nome'];
$sobrenome = $_POST['sobrenome'];
$email = $_POST['email'];
$senha = $_POST['senha'];
$sql = mysqli_query($conexao,"INSERT INTO `usuarios`('', 'nome', 'sobrenome', 'email', 'senha'");
}
{
die("<br />Nao foi possivel inserir registro: " . mysql_error());
}
echo "<br />Um novo registro foi feito!";
?>
</body>
</html>
the question code has already been edited, so the error that generated the question doesn’t even make sense anymore. The question you asked is already answered, so you’ve already changed the HTML part. you have many other errors in the code, which have already been mentioned by several people, but if you have other mistakes, create new questions.
– Miguel Mesquita Alfaiate
Ruan, I’m glad you found the solution to your [en.so] problem! However, just a hint, do not need to tidy the code of the question, otherwise whoever sees the question later will not understand what happened. Hug!
– utluiz
Okay, I won’t do the edits,!!
– Ruan Rodrigues