I have used nearly this exact code on another page and it worked great, but here... not so much.
I have a drop down menu populated with elements from database columns. Whichever element is selected should be stored in the variable $Product
, but for some reason I cannot figure out, it is simply not making it there and the rest of my script (parts I didn't post) doesn't work. Thanks in advance for your help.
<?php
if(isset($_POST['submit'])) {
$Product = $_POST['Product_List'];
} else {
$Product = "";
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Add Chemical Inventory</title>
</head>
<body>
<div id="form_div">
<div id="form_label">
<h2>Add Chemical Inventory</h2>
<form action="Add_Chemical_Inventory.php">
<?php
$List = "SELECT Product_ID, Product_Name FROM `products`";
$list_result = mysqli_query($connection,$List);
echo "Product: <select name='Product_List'>";
while($row = mysqli_fetch_assoc($list_result)){
echo "<option value='".$row['Product_ID'] ."'>".$row['Product_Name']."</option>";
}
echo "</select>";
echo "<br />";
?>
</form>
</div>
</div>
</body>
</html>