php填充的html选择数据库

php填充的html选择数据库,php,jquery,html,Php,Jquery,Html,我有一个带有两个html选择标记的表单的页面。 第一个html select标记由来自php的数据填充 <select name="groep" id="groep"> <?php for ($i = 0; $i < $aantal; $i++) { echo "<option value='" . $groepen[$i] . "'>" . $groepen[$i] . "</option>

我有一个带有两个html选择标记的表单的页面。 第一个html select标记由来自php的数据填充

<select name="groep" id="groep">
        <?php 
        for ($i = 0; $i < $aantal; $i++) {
            echo "<option value='" . $groepen[$i] . "'>" . $groepen[$i] . "</option>";
        } ?></select>
现在,我希望将两个select标记中的两个选定值写入我的mysqldb。 问题是提交时,第二个select标记中的选定值未通过


我可能有什么问题?

您需要在第二次选择中添加一个id

<select name="schoolselect" id="schoolselect"><option>Selecteer eerst de groep.</option></select>

这种方法看起来相当乏味,为什么不从first select中获取第二个select框的所有项目以及匹配的ID,并在加载时将它们隐藏起来,然后在更改第一个select时相应地执行操作(如果有意义的话)?
$(document).on('change', '#groep', function() {

        var str = "";
        $( "#groep option:selected" ).each(function()
        {
            str += $( this ).text() + " ";
        });


        var url = "../getSchools.php?q=" + $( "#groep option:selected").text();

        $( "td#schoolselect" ).load( url );
    });
<select name="schoolselect" id="schoolselect"><option>Selecteer eerst de groep.</option></select>