What I would like to have happen is the default sets you enter in be 1. Then if you need more you press an "Additional" button, or something, and it updates to give you another set that you can fill in.
The form will then be processed by a php script, which will need to know how many sets were created.
I'll attach the code for what I have already.
This is the processing script. Notice the use of $numberOfAdditionalRows to determine how many rows exist. This is just a static value right now.
Code: Select all
$numberOfAdditionalRows=10;
if($_SESSION['documentInfoSet'])
{
if(isset($_POST['Enter']))
{
$documentInfo=$_SESSION['documentInfo'];
$county=$documentInfo[1][0];
$c=2;
for($b=0;$b<$numberOfAdditionalRows;$b++)
{
$wasSet=FALSE;
$_POST['documentNumber'.$b]=removeBlankSpaces($_POST['documentNumber'.$b]);
if($_POST['documentNumber'.$b]!='')
{
if(validNumber($_POST['documentNumber'.$b]))
{
$documentInfo[$c][1]=$_POST['documentNumber'.$b];
$wasSet=True;
}
else
{
$error='Invalid Entry. Please make sure to only use numbers for Document Number, Volume, and Page.';
}
}
if($wasSet)
{
$documentInfo[$c][0]=$county;
$c++;
}
}
if(!isset($error))
{
if(isset($_SESSION['documentInfoSet']))
{
unset($_SESSION['documentInfoSet']);
}
$_SESSION['documentInfoSet']=TRUE;
$_SESSION['documentInfo']=$documentInfo;
header("Location: ./Upload.php", true, 302 );
}
}
}
?>This is the front end which displays the html form. $numberOfAdditionalRows is used again here.
Code: Select all
<form action="./Additional.php" method="post" name="form">
<table align="center" border="1">
<?php
for($a=0;$a<$numberOfAdditionalRows;$a++)
{
?>
<tr><th colspan="4"><?php echo ($a+1); echo ")";?></th></tr>
<tr>
<th> Document Number: </th>
<td> <input type="text" name="documentNumber<?php echo $a;?>"></td>
</tr>
<?php
}
?>
<tr>
<td colspan="10" align="center">
<input type="submit" name="Enter" value="Enter" >
</td>
</tr>
</table>
</form>