0
I have a form, where the fields correspond to the amount registered in the database. I am bringing as follows:
<?php
....
$contar = $metodos->contarCadastro($chave);
$num = 1;
for($c = 1; $c <= $contarPaxes; $c++){
?>
<div align='left'><label>Nome Completo:</label> <input type='text' name='NomeCompleto[]' id='nome' class='form-control' maxlenght='100'></div>
<div align='left'><label>E-mail:</label> <input type='text' name='Email[]' id='email' class='form-control' maxlenght='100'></div>
<div align='left'><label>Data de Nascimento:</label> <input type='text' name='DataNascimento[]' id="date" class='form-control' maxlenght='100'></div>
<div align='left'><label>CPF:</label> <input type='text' id="cpf" name='CPF[]' class='form-control' maxlenght='100'></div>
<?php } ?>
And the jquery:
$("#btnCadastrar").on("click", function() {
var nome = $("#nome").val();
var email = $("#email").val();
var data = $("#date").val();
var cpf = $("#cpf").val();
$.post("cadastrar.php", {Nome: nome, Email: email, data: data, CPF: cpf }, function() {
$(document).ready(function () {
$('#myModa3').modal();
});
});
});
But if you have to register 03 people, it only registers one. How do I so that in the case of array, register by jquery?
how is getting your php?
– Sr. André Baill
With the traditional mode. mysqli_query($connection, "INSERT INTO...");
– user24136