I'm trying to create a new database in the database with the following code and returns the error: Insert value list does not match column list or the registry is created but blank, the fields are NOT NULL, I already tried other options here in the forum and nothing.
I've researched, refaced and nothing.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><linkrel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="row">
<div class="center-block form-novo-cad">
<form method="post" action="novoCadSend.php">
<div class="form-group">
<label for="name">Nome:</label>
<input type="text" class="form-control" id="name">
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email">
</div>
<div class="form-group">
<label for="telefone">Telefone:</label>
<input type="text" class="form-control" id="telefone">
</div>
<div class="form-group">
<label for="endereco">Endereço:</label>
<input type="text" class="form-control" id="endereco">
</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6" style="margin-left: -15px;">
<div class="form-group">
<label for="numero">Número:</label>
<input type="text" class="form-control" id="numero">
</div>
</div><br><br><br><br>
<div class="form-group">
<label for="bairro">Bairro:</label>
<input type="text" class="form-control" id="bairro">
</div>
<div class="form-group">
<label for="cidade">Cidade:</label>
<input type="text" class="form-control" id="cidade">
</div>
<button type="submit" class="btn btn-default">Criar Cadastro</button>
</form>
</div>
</div>
//novoCadSend.php // inclui o arquivo de inicialização require 'init.php'; // resgata variáveis do formulário $name = isset( $_POST[ 'name' ] ) ? $_POST[ 'name' ] : ''; $email = isset( $_POST[ 'email' ] ) ? $_POST[ 'email' ] : ''; $telefone = isset( $_POST[ 'telefone' ] ) ? $_POST[ 'telefone' ] : ''; $endereco = isset( $_POST[ 'endereco' ] ) ? $_POST[ 'endereco' ] : ''; $numero = isset( $_POST[ 'numero' ] ) ? $_POST[ 'numero' ] : ''; $bairro = isset( $_POST[ 'bairro' ] ) ? $_POST[ 'bairro' ] : ''; $cidade = isset( $_POST[ 'cidade' ] ) ? $_POST[ 'cidade' ] : ''; $PDO = db_connect(); try { $PDO->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION ); $stmt = $PDO->prepare( 'INSERT INTO users VALUES(:name, :email, :telefone, :endereco, :numero, :bairro, :cidade)' ); $stmt->execute( array( //':id' => $id, ':name' => $name, ':email' => $email, ':telefone' => $telefone, ':endereco' => $endereco, ':numero' => $numero, ':bairro' => $bairro, ':cidade' => $cidade, ) ); echo $stmt->rowCount(); } catch ( PDOException $e ) { echo 'Error: ' . $e->getMessage(); }