更新时间:2021-07-29 21:53:42
例如,我认为form
可能会更好
I think form
may be better, for example
<form id="myform" method="post">
<select name = 'peer-id' style = 'position: relative' onchange="change()">
<option value="1">12</option>
<option value="2">15</option>
<option value="3">16</option>
<option value="4">18</option>
</select>
</form>
<script>
function change(){
document.getElementById("myform").submit();
}
</script>
在上面的代码中,每当更改select的值时,它将发布到后端,然后根据发布的值,您可以想要,要获取php中的peer-id,您可以使用以下代码
In the above code, whenever you change the value of select, it will post to the backend, then according to the posted value, you can do want you want, to get the peer-id in php, you can use the following code
$peer-id = $_POST['peer-id'];
希望有帮助!