0
I am in need of some help because I am a bit stuck on that. I have a form where I put information on a worker. Now I want to change this page to be able to insert several workers. At most up to 16 workers.
Pagina1:
<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>
and now I want to find a way for that form to be repeated until the user wishes. And whenever a new record is stored 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 I will 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 will not fetch the insertion but it will fetch the insertir4 that is to add worker4
Want to reload the page for each new form, or appear on the same page?
– Sergio
Show the same page but to store in different places.
– ChrisAdler
From what I understand this should be done on the client side. Have some library like Mootools or jQuery?
– Sergio
I am using php/html/mysql Workbench . I am seeing if there is such a solution as easy resolution.
– ChrisAdler
Excuse my insistence, but I think what you need is not related to php/mysql. Do you need to fetch data from the database for each new form? Or you just need to create a new form on the page for the user to fill in?
– Sergio
For example the user has 3 workers and wants to enter them. I want the same form to appear for the 3 workers. The only thing that varies are the places that are stored
– ChrisAdler
This is what you seek? http://jsfiddle.net/KJLdB/
– Sergio
Yes something like that. When I make a new worker appear on a new page, it is not a very long page. Have a save button at the end of each page and then ask new user?
– ChrisAdler
In the comments above you wrote "Show the same page but to store in different places.". But do you want me to save the first form and reload the page with a new form? Then this can be done on the server side. You can join the full HTML with the
<form>
also?– Sergio
I already put the form. In the worker1 appear name1, functionõ1, medical fitness data1 and worker2 Nome2,function2, medical fitness data2
– ChrisAdler
Reload a page with a new form.
– ChrisAdler
There is an easier way than creating 16 pages of correct registration?
– ChrisAdler