从下拉菜单中选择不会插入到已分配的变量中

时间:2016-06-04 23:52:20

标签: php

我在另一个页面上使用了几乎这个确切的代码并且效果很好,但是在这里......不是那么多。

我有一个下拉菜单,其中填充了数据库列中的元素。无论选择哪个元素都应该存储在变量$Product中,但由于某种原因我无法弄清楚,它根本就没有把它放在那里而我的其余部分(我没有发布的部分)不起作用。在此先感谢您的帮助。

<?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>

1 个答案:

答案 0 :(得分:0)

您忘记了subprocess.call(['scp', '%s@sew.cwe.edu:' % user_acc + ''.join(dir_[0][:-1]), '%s/%s/dicom/' % (dicom_dir, sub)]) 代码中的method属性。

默认情况下,该方法设置为<form>,并且由于您的代码需要get个数据,因此它不会将其保存到变量中。

post