0
Colleagues.
I have a form that contains an array that is on the.php sign-up page, see:
<input type="text" name="NomeCliente[]">
<input type="text" name="IdadeCliente[]">
<input type="text" name="CPFCliente[]">
And I have the following method that is inside the methodos.class.php file:
public function cadastrarPaxSingle($nomeCliente,$idadeCliente,$cpfCliente){
// Aqui faço o cadastramento no banco de dados
}
However, I am registering within the.php registration page in this way:
for($i = 0; $i < count($nomeCliente); $i++){
$cadastrar = mysqli_query($conexao,"INSERT INTO tbcadastro VALUES(null,'".$nomeCliente[$i]."','".$idadeCliente[$i]."','".$cpfCliente[$i]."')");
}
But when I call the method to register within the method:
$métodos->cadastrarPaxSingle($nomeCliente,$idadeCliente,$cpfCliente);
Register a client and no more. How I would make the code below work?
public function cadastrarPaxSingle($nomeCliente,$idadeCliente,$cpfCliente){
for($i = 0; $i < count($nomeCliente); $i++){
$cadastrar = mysqli_query($conexao,"INSERT INTO tbcadastro VALUES(null,'".$nomeCliente[$i]."','".$idadeCliente[$i]."','".$cpfCliente[$i]."')");
}
}
and how is Insert?
– Daniel Omine
Hi Daniel. I adjusted my question. There is the Internet there.
– user24136
variables in Insert, are not wrong?
$nome
would not be$nomeCliente
, for example?– Daniel Omine
Opa Daniel. Ajustei. I put the code manually and it was a nomenclature error when putting here.
– user24136
the variable
$conexao
, comes from where?– Daniel Omine