如何将正确的 html 选择值传递给 $_POST php
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4425210/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 13:02:39 来源:igfitidea点击:
How to pass correct html select value to $_POST php
提问by ganjan
I have tried html like this:
我试过这样的html:
<form method="post">
<select id="select" size="2 ">
<option value="3">test</option>
<option value="4">test2</option>
</select>
<button type="submit" value="execute">
</form>
How do I get a 3 or 4 value in the post array
如何在 post 数组中获得 3 或 4 值
$_POST['select']
?
?
回答by Ilyssis
Add the name tag...
添加名称标签...
<select id="select" name="select" size="2 ">