I am producing a input form, the code of which can be seen below:
<form method="post" action="../php/addshopfloorcount.php">
<table width="80%" border="1" class="table_text">
<tr>
<td colspan="4" class="table_text">Count Information:</td>
</tr>
<tr>
<td width="30%" colspan="-3" align="left">Count ID</td>
<td width="70%" align="left" >Department</td>
<td width="70%" align="left" >Username</td>
</tr>
<tr>
<td colspan="-3" align="right"><input name="id" type="text" id="id" size="10" maxlength="10" /></td>
<td align="left"><select name="department" id="department">
<option value="--- Select Department ---">--- Select Department ---</option>
<?
// Get records from database (table "name_list").
$list=mysql_query("select * from department order by id asc");
// Show records by while loop.
while($row_list=mysql_fetch_assoc($list)){
?>
<option value="<? echo $row_list['id']; ?>" <? if($row_list['id']==$select){ echo "selected"; } ?>><? echo $row_list['department']; ?> </option>
<?
// End while loop.
}
?>
</select></td>
<td align="left"><select name="username" id="username">
<option value="--- Select Username ---">--- Select Username ---</option>
<?
// Get records from database (table "name_list").
$list=mysql_query("select * from members order by id asc");
// Show records by while loop.
while($row_list=mysql_fetch_assoc($list)){
?>
<option value="<? echo $row_list['id']; ?>" <? if($row_list['id']==$select){ echo "selected"; } ?>><? echo $row_list['username']; ?> </option>
<?
// End while loop.
}
?>
</select></td>
</tr>
</table>
<p> </p>
<table width="80%" border="1" class="table_text">
<tr>
<td colspan="5" class="table_text">Product Information:</td>
</tr>
<tr>
<td width="7%" align="left"> </td>
<td width="35%" colspan="-3" align="left">Barcode</td>
<td width="29%" align="left" >Product</td>
<td width="29%" align="left" >Quantity</td>
</tr>
<tr>
<td align="right"><input type="checkbox" name="chk" id="chk" /></td>
<td colspan="-3" align="right"><select name="barcode" id="barcode">
<option value="--- Select Department ---">--- Select Department ---</option>
<?
// Get records from database (table "name_list").
$list=mysql_query("select * from lines order by barcode asc");
// Show records by while loop.
while($row_list=mysql_fetch_assoc($list)){
?>
<option value="<? echo $row_list['barcode']; ?>" <? if($row_list['barcode']==$select){ echo "selected"; } ?>><? echo $row_list['barcode']; ?> </option>
<?
// End while loop.
}
?>
</select></td>
<td align="left"><input type="text" name="product" id="product" /></td>
<td align="left"><input type="text" name="quantity" id="quantity" /></td>
</tr>
<tr>
<td align="right"><input type="checkbox" name="chk" id="chk" /></td>
<td colspan="-3" align="right"><select name="barcode" id="barcode">
<option value="--- Select Department ---">--- Select Department ---</option>
<?
// Get records from database (table "name_list").
$list=mysql_query("select * from lines order by barcode asc");
// Show records by while loop.
while($row_list=mysql_fetch_assoc($list)){
?>
<option value="<? echo $row_list['barcode']; ?>" <? if($row_list['barcode']==$select){ echo "selected"; } ?>><? echo $row_list['barcode']; ?> </option>
<?
// End while loop.
}
?>
</select></td>
<td align="left"><input type="text" name="product" id="product" /></td>
<td align="left"><input type="text" name="quantity" id="quantity" /></td>
</tr>
<tr>
<td align="right"><input type="checkbox" name="chk" id="chk" /></td>
<td colspan="-3" align="right"><select name="barcode" id="barcode">
<option value="--- Select Department ---">--- Select Department ---</option>
<?
// Get records from database (table "name_list").
$list=mysql_query("select * from lines order by barcode asc");
// Show records by while loop.
while($row_list=mysql_fetch_assoc($list)){
?>
<option value="<? echo $row_list['barcode']; ?>" <? if($row_list['barcode']==$select){ echo "selected"; } ?>><? echo $row_list['barcode']; ?> </option>
<?
// End while loop.
}
?>
</select></td>
<td align="left"><input type="text" name="product" id="product" /></td>
<td align="left"><input type="text" name="quantity" id="quantity" /></td>
</tr>
</table>
<table width="50%" border="0">
<tr>
<td><input type="submit" name="Add Row" id="Add Row" value="Add Row" /></td>
<td><input type="submit" name="Remove Row" id="Remove Row" value="Remove Row" /></td>
<td><input type="submit" name="save_count" id="save_count" value="Save Count" /></td>
</tr>
</table>
What would be the best way of inserting the information in a sql database, as one count would have a number of lines?