I can't figure out why my drop down list, which is populated from Mysql, is giving me a number instead of the string value. Below is the code for the drop down list, which properly displays the item names. The problem is when I pull the selected item later I get a number instead of the string item name the user selected.
<select name="product1" class="form-control" id="sel1">
<?php
require('./PHPConnect.php');
$dropdown = array();
$downquery = "SELECT * FROM masterDESC";
$response = @mysqli_query($dbc, $downquery);
if($response){
while(($row = @mysqli_fetch_array($response,MYSQL_ASSOC))){
$dropdown[] = $row['DESCRIPTION'];
}
}
foreach($dropdown as $key => $value){
echo '<option value=' . $key . '>' . $value . '</option>';
}
echo "</select>";
mysqli_close($dbc);
?>
Here is the code later used to pull the selected item.
$product1 = $_POST['product1'];
Any thoughts?