You can create the form as one file, without submit / form header. With variable fieldnames:
<input type=\"text\" name=\"employer[$i]\">
Now the dispatcher starts his day, with a startup form, basically, a form which asks him how many dispatches for that day (If not fixed).
Then you submit the form, and create a list of forms:
for ($i = ; $i<$POST[total_dispatches]; $i++)
{
include("my_form.php");
}
This will create a list of all the sub-forms. You can then create a head & footer for the form, with a safe button, which submits the form, processes the info, and reloads the form, with the data from the database. C'est tout.
I use a similar approach for editing picture-album databases:
upload picture form:
<p>
You can upload up to $max_num_upload pictures at a time.
</p>";
for($i = 0; $i<$max_num_upload; $i++)
{
$body.="
Foto $i: <input class=\"formel_1\" type=file name=file$i size=30><br>";
}
$body.="
<button class=\"button_small\" name=\"submit\" type=\"submit\">Upload</button></td></tr>
</form>";
edit form:
if($photo_exist)
{
$picturelist = "";
foreach($photos as $photo_id => $details)
{
$picturelist .= "
<tr><td class=\"formel_2\"><img src=\"$baseurl".$photoalbumfolder."th_$details[name]\" alt=\"$details[name]\"><br>
</td><td class=\"formel_2\">
<input class=\"formel_1\" type=\"text\" name=\"picture[$photo_id][title]\" size=\"45\" value=\"$details[title]\"> Picture title <br>
<input class=\"formel_1\" type=\"text\" name=\"picture[$photo_id][date]\" size=\"45\" value=\"$details[date]\"> Picture date (yyyy-mm-dd)<br>
<input class=\"formel_1\" type=\"text\" name=\"picture[$photo_id][location]\" size=\"45\" value=\"$details[location]\"> Picture Location <br>
<a href=\"index.php?action=9&image=$photo_id&remove=1&album=$album\">Delete picture</a>
</td></tr>" ;
}
$picturelist .="</table>";
}
$head_title .= "Aanpassen van album $albums[$album]";
$body .="
<table>
<tr><td colspan=\"2\">
<form action=\"index.php\" method=\"POST\">
<input type =\"hidden\" name=\"action\" value=\"9\">
<input type=\"hidden\" name=\"upload\" value=\"update\">
<input type =\"hidden\" name=\"album\" value=\"$album\">
</span>
</td>
</tr>
".$picturelist."
<INPUT class=\"button_small\" TYPE=SUBMIT VALUE=\"Safe edits\"></form>
";