I’m trying to design an inventory system and im running into problems with my code.
I have a page where I want to add a number of parts to a order. However, sometimes we may use 1 part, sometimes 2, sometimes three, or sometimes none at all. I am pulling the data I need out of the database, but, how do I add a additional array that is blank or maybe one that saids “Empty” when they user doenst need to add a part. Or a custom option that is coded right into the php page. (prefer to put it at the top of the option list)
Here is my code:
Part 1:<select size="1" name="part1">
<?
$opt = @("SELECT * FROM inventory2 WHERE part_type='5' and availability>'0'");
if(@mysql_num_rows($opt) > 0){
while($opt_desc = @mysql_fetch_array($opt)){
?>
<option value="<?php echo $opt_desc[1] ?>"><? echo $opt_desc[2]; ?> - <? echo $opt_desc[4]; ?></option>
<? }} ?>
</select>
Part 2:<select size="1" name="part2">
<?
$opt = @("SELECT * FROM inventory2 WHERE part_type='5' and availability>'0'");
if(@mysql_num_rows($opt) > 0){
while($opt_desc = @mysql_fetch_array($opt)){
?>
<option value="<?php echo $opt_desc[1] ?>"><? echo $opt_desc[2]; ?> - <? echo $opt_desc[4]; ?></option>
<? }} ?>
</select>
Part 3:<select size="1" name="part3">
<?
$opt = @("SELECT * FROM inventory2 WHERE part_type='5' and availability>'0'");
if(@mysql_num_rows($opt) > 0){
while($opt_desc = @mysql_fetch_array($opt)){
?>
<option value="<?php echo $opt_desc[1] ?>"><? echo $opt_desc[2]; ?> - <? echo $opt_desc[4]; ?></option>
<? }} ?>
</select>