I am creating an Offline ordering system for the company i work for, which basically lets them create purchase orders when the main system or network fails. I have it working OK but i need to add an option for Pack Sizes. I have created this as a SELECT list in an HTML form, which retrieves the various pack sizes from the products table; it should then submit the chosen pack size to a temporary table, which is displayed on the order page. However, it seems to be submitting a null value.
My original code was :
Code: Select all
<form method="POST" action="add.php">
Quantity :
<input type="text" name="qty" size="2">
<input type="hidden" name="prodnum" value="<?php echo $prodnum ?>"><br><br>
Pack Size :
<select name="packsize" size="1" method = "POST" action = "add.php">
<option value="$pack1"><?php echo "Pack 1 : ".$pack1; ?></option>
<option value="$pack2"><?php echo "Pack 2 : ".$pack2; ?></option>
</select>I have got around it by using the below, which asks the user to manually enter the pack size; i would like to get away from this method if possible.
Code: Select all
<form method="POST" action="add.php">
Quantity :
<input type="text" name="qty" size="2">
<input type="hidden" name="prodnum" value="<?php echo $prodnum ?>"><br><br>
Pack Size :
<input type="text" name="packsize" size = "2"><br />
<?php echo "Enter <b>".$pack1."</b> for Pack 1" ?><br />
<?php
// Check for a second pack size - else display a message.
if ($pack2 == "") {
echo "<b>This product is only in Singles.</b><br>";
}
elseif ($pack2 != "") {
?>
<?php echo "Enter <b>".$pack2."</b> for Pack 2" ?><br /><br />
<?php } ?>
<center><input type="submit" name="Submit" value="Add to Order"></center>
</form>I would be gratefull of any help.