The $_POST method is not giving me the value of the selected option in my select box:
<div class="amazonpackaging_form">
<div class="inner_form">
<p>Select an Option to choose a SKU:</p>
<form class="rad_buttons_1" action="" method="POST">
<input type="radio" name="jewelry_type" value="locket"><label name="type" value="locket">Lockets</label><br>
<input type="radio" name="jewelry_type" value="jewelry"><lable name="type" value="jewelry">Jewelry</label><br>
<input type="submit" name="submit" value="submit">
</form>
<?
global $radio_input;
if (isset($_POST['submit']) and ! empty($_POST['submit'])){
if (isset($_POST['jewelry_type'])){
$radio_input = $_POST['jewelry_type'];
}
}
?>
</div>
<div class="inner_form">
<form action="" method="POST">
<?
$flag = "false";
global $JEWELRY_SKU;
if (isset($_POST['submit']) and ! empty($_POST['submit'])){
echo "<p class='title'>SKU:</p>";
if ($radio_input == "locket"){
$sql_1 = "SELECT SKU FROM tblLocketInventory";
$flag = "true";
}
elseif ($radio_input == "jewelry"){
$sql_1 = "SELECT SKU FROM tblJewelryInventory";
$flag = "true";
}
if ($flag == "true"){
$result_1 = $conn->query($sql_1);
$counter = 1;
$db_sku_list = array();
if ($result_1->num_rows > 0) {
while($row = $result_1->fetch_assoc()) {
$db_sku_list[$counter] = $row["SKU"];
$counter = $counter + 1;
}
}
$counter = 1;
echo "<select name='sku_select'>";
foreach ($db_sku_list as $_sku){
if ($counter == 1){
echo "<option value=".$_sku." selected='selected' name = ".$_sku.">".$_sku."</option>";
}
else {
echo "<option value = ".$_sku." name = ".$_sku.">".$_sku."</option>";
}
$counter++;
}
echo "</select>";
}
$JEWELRY_SKU = $_POST['sku_select'];
echo "<div class='split1'><p>Quantity Used:</p><input type='text' name='quantity' class='form_inputbox1'></div>";
echo "<div class='split2'><p>Quantity Damaged:</p><input type='text' name='quantity' class='form_inputbox1'></div>";
}
?>
</form>
</div>
</div>
<?
$JEWELRY_SKU = $_POST['sku_select'];
if ($radio_input == "locket"){
include ("amazonlockets.inc");
}
?>
I'm getting an error on the line
$JEWELRY_SKU = $_POST['sku_select'];
Notice: Undefined index: sku_select in /Applications/XAMPP/xamppfiles/htdocs/ATDWebApp/sku.inc on line 65
I've tried playing around with this in numerous ways, but I cannot figure out why I'm not getting a value from this.
I have tried putting it in a separate form in separate php code and I still have the same error. Any ideas why?