I kind of got it working. Here is the WHILE loop that creates the form:
Code: Select all
$count=0;
while ($doornum = mysql_fetch_row($door_num)) {
$doorname = mysql_fetch_row($door_name);
//$loadername = mysql_fetch_row($loader_name);
echo "<tr align='center'><td align='right'> <b>Door $doornum[0]</b></td><td align='center'>Misloaded zips: <input type='text' name='zips$doornum[0]'><input type='hidden' name='door_number$doornum[0]' value='$doornum[0]'></td></tr>";
}
$count++;
Once the page is generated, it looks like this in HTML:
Code: Select all
<tr align='center'><td align='right'> <b>Door 418</b></td><td align='center'>Misloaded zips: <input type='text' name='zips418'><input type='hidden' name='door_number418' value='418'></td></tr>
<tr align='center'><td align='right'> <b>Door 419</b></td><td align='center'>Misloaded zips: <input type='text' name='zips419'><input type='hidden' name='door_number419' value='419'></td></tr>
<tr align='center'><td align='right'> <b>Door 420</b></td><td align='center'>Misloaded zips: <input type='text' name='zips420'><input type='hidden' name='door_number420' value='420'></td></tr>
<tr align='center'><td align='right'> <b>Door 421</b></td><td align='center'>Misloaded zips: <input type='text' name='zips421'><input type='hidden' name='door_number421' value='421'></td></tr>
<tr align='center'><td align='right'> <b>Door 422</b></td><td align='center'>Misloaded zips: <input type='text' name='zips422'><input type='hidden' name='door_number422' value='422'></td></tr>
<tr align='center'><td align='right'> <b>Door 423</b></td><td align='center'>Misloaded zips: <input type='text' name='zips423'><input type='hidden' name='door_number423' value='423'></td></tr>
<tr align='center'><td align='right'> <b>Door 424</b></td><td align='center'>Misloaded zips: <input type='text' name='zips424'><input type='hidden' name='door_number424' value='424'></td></tr>
<tr align='center'><td align='right'> <b>Door 425</b></td><td align='center'>Misloaded zips: <input type='text' name='zips425'><input type='hidden' name='door_number425' value='425'></td></tr>
<tr align='center'><td align='right'> <b>Door 426</b></td><td align='center'>Misloaded zips: <input type='text' name='zips426'><input type='hidden' name='door_number426' value='426'></td></tr>
<tr align='center'><td align='right'> <b>Door 427</b></td><td align='center'>Misloaded zips: <input type='text' name='zips427'><input type='hidden' name='door_number427' value='427'></td></tr>
<tr align='center'><td align='right'> <b>Door 428</b></td><td align='center'>Misloaded zips: <input type='text' name='zips428'><input type='hidden' name='door_number428' value='428'></td></tr>
After that form is submitted, I have a IF statement that to see if the $_POST value "post" has been sent. If so, it goes through this loop to generate the $_POST variables. This loop would be just like if I manually typed in
Code: Select all
$zips418 = $_POST['zips418'];
$zips419 = $_POST['zips419'];
$zips420 = $_POST['zips420'];
Since I can't manually type it in to the code because the database may change, that's why I created this loop to make the variables for me:
Code: Select all
if (isset($_POST['post'])) {
$door_num="SELECT door_num FROM load_doors";
$door_num=mysql_query($door_num);
$date = $_POST['date'];
$count = 0;
while ($doornum = mysql_fetch_row($door_num)) {
$zips[0] = $_POST['zips[0]'];
//$zips['$doornum[0]'];
echo "Door num: $doornum[0] - Zips: $zips[0] - Date: $date<br>";
}
$count++;
}
Since I'm simply echo-ing everything out for testing purposes, everything is working except for the $zips[0] array. The door number generate on the page after submission by $doornum[0] and the $date works too, but I can't get it to make
generate this
Code: Select all
$zips418 = $_POST['zips418'];
$zips419 = $_POST['zips419'];
$zips420 = $_POST['zips420'];
. If I can get the WHILE loop to generate the $zips[0], I know how to go from there.