我试图获取下拉菜单的值。用户点击按钮selectOptionud
后会创建下拉菜单。但是,当我回复<html>
<body>
<?php
if (isset($_POST['submitundrafted'])) {
$selectOptionud = $_POST['filter_ud']; //undrafted selection
echo $selectOptionud;
}//end of submitundrafted
if (isset($_POST['undrafted'])) {
$menu= "<select name='filter_ud' id='filter_ud'>
" . $options . " //I have erased the previous code that gets the value of this variable.
</select>";
echo $menu;
?>
<form action="transfer.php" method="post">
<input type="submit" name="submitundrafted" value="Submit" />
</form>
<?php
}
?>
<form action="transfer.php" method="post">
<input type="submit" name="undrafted" value="With Undrafted Players">
</form>
</body>
</html>
时,我没有任何价值。知道这里发生了什么吗?
no implicit conversion of String into Integer
答案 0 :(得分:0)
此处$options
将是这样的
<option value="1">abc</option>
<option value="2">bcd</option>
<option value="3">def</option>
if (isset($_POST['undrafted'])) {
$menu= "<select name='filter_ud' id='filter_ud'>
" . $options . " //I have erased the previous code that gets the value of this variable.
</select>";
?>
<form action="transfer.php" method="post">
<?php echo $menu;?>
<input type="submit" name="submitundrafted" value="Submit" />
</form>
<?php
}?>