php后台如何获取html下拉菜单的值,请大侠们帮忙
<div id="create" style="display:block;">
<form method="POST" action="__APP__/Index/add">
<div class="modal-body" >
请选择: <select id="selectRole1" >
<option value="0">请选择</option>
{foreach $pe.roles as $value}
<option value="{$value.id}">{$value.role_name}</option>
{/foreach}
</select>
</div>
<div >
<input type="submit" value="提交"/>
</div>
</from>
</div>
html
php
action
form
select
------解决方案--------------------在你的select标签中设置name属性,在PHP后台通过name属性值获取
例如:
<select name="select1">
<option value="Test">测试</option>
</select>
PHP代码:
if(isset($_POST["select1"]))
{
echo $_POST["select1"];
}
------解决方案--------------------echo @$_POST["selectRole1"];
就可以取得了