I'm in need of help because I'm a bit blocked on this issue. I have a form where I put information about a worker. Now I want to change this page to be able to insert several workers. At most up to 16 workers.
Page 1:
<form method="post" action="inserir4.php" name="dados-do-cliente" enctype="multipart/form-data">
<center><h1>Trabalhadores:</h1></center><br>
<h3>Nome: <input type="text" name="Nome1"> Função: <input type="text" name="Funcao1"><span style="padding-left:150px">
<Center><h1>Documentos Trabalhadores : </h1></center>
<div class="major">
<h2><center> <b><p>Fichas de aptidão medica:</p> </h2>
</b> </center>
<center> <h3> Data Validade:
<input type="date" name="MedicaValidade">
Anexar Documento: <input type="file" name="MedicaAnexo"></h3></center>
</div>
<center><button type="submit" style='width: 120px' value="enviar">Gravar</button>
</center>
Now I want to find a way for this form to be repeated until the user wants it. And whenever a new record is saved in the name of the variable +1 Example page 2:
<form method="post" action="inserir5.php" name="dados-do-cliente" enctype="multipart/form-data">
<center><h1>Trabalhadores:</h1></center><br>
<h3>Nome: <input type="text" name="Nome2"> Função: <input type="text" name="Funcao2"><span style="padding-left:150px">
<Center><h1>Documentos Trabalhadores : </h1></center>
<div class="major">
<h2><center> <b><p>Fichas de aptidão medica:</p> </h2>
</b> </center>
<center> <h3> Data Validade:
<input type="date" name="MedicaValidade2">
Anexar Documento: <input type="file" name="MedicaAnexo2"></h3></center>
</div>
<center><button type="submit" style='width: 120px' value="enviar">Gravar</button>
</center>
At the end of the insert I put this option:
if ($sqlinsert)
{
echo "<script>var r = confirm('Adicionar novo trabalhador?');" .
"if (r == true) {window.open('Trabalhadores3.html','_self','false');}" .
"else {window.open('Equipamentos.html','_self','false');}</script>";
}
If you want another worker, click Yes and go to the next page if you do not want to go directly to the last page. But I have a big problem because when I go directly to the last page it does not go to get the insertItems but it will get the insert4 that is to add worker4