我只想获取下拉列表的内容并将其存储在数组中。
我可以显示下拉列表,但它没有获取我选择的内容。
echo '<br><br><br><br><br>
<div class="Table">
<table border="2pt solid black" align="left" cellpadding="2px" bordercolor=black>
<tr>
<td width = "7%">
<div align = "left"><b>BRAND NAME</div></b>
</td>
<td width = "7%">
<div align = "left"><b>INGREDIENT</div></b>
</td>
<td width = "3%">
<div align = "left"><b>QUANTITY</div></b>
</td>
<td width = "7%">
<div align = "left"><b>MEASUREMENT</div></b>
</td>
</tr>';
for ($x = 0; $x < sizeof($rowarray); $x++) {
$query = "select R.name AS RAWNAME, I.name AS INGREDIENTNAME, R.quantity AS RAWQUANTITY from rawmaterial R JOIN ingredient I ON R.ingredient_id = I.ingredient_id where R.rawmaterial_id='{$rowarray[$x]}'";
$res = mysqli_query($dbc, $query);
while ($fetch = mysqli_fetch_array($res, MYSQL_ASSOC)) {
echo "<tr>
<td width=\"7%\">
<div align=\"left\">{$fetch['RAWNAME']}</div>
</td>
<td width=\"3%\">
<div align=\"left\">{$fetch['INGREDIENTNAME']}</div>
</td>
<td width=\"3%\">
<div align=\"left\"><input type='name' name='quantity[]' placeholder={$fetch['RAWQUANTITY']}></input></div>
</td>
<td width=\"7%\">
<div align=\"left\">";
echo "<select name = 'measure'>";
$mesr = mysqli_query($dbc, 'select measure from measure_ref');
while ($row = mysqli_fetch_array($mesr, MYSQLI_ASSOC)) {
$mes = $row['measure'];
echo '<option value ='.$mes.'>'.$mes.'</option>';
}
echo "</select>";
echo "</div>";
echo "</td>";
echo "</tr>";
}
}
echo '</table></div>';
$messarray = array();
$mes = $_POST['measure'];
$row = array();
foreach ($mes as $row) {
array_push($messarray, $row);
}
答案 0 :(得分:0)
检查以下几点。