有没有一种方法可以在表单标签中获取name属性的值?我正在使用PHP,但在$ _POST
中看不到它。
最佳答案
Is there a way to get the value of the name attribute in the form tag? I'm using PHP and don't see it in $_POST.
不,表单的名称属性永远不会设置为作为POST数据的一部分发送到服务器。
解决此问题的最简单方法是添加一个包含名称的隐藏表单元素
<input type="hidden">
。<form name="myform" method="post" action="" enctype="multipart/form-data">
<input type="hidden" name="frmname" value=""/>
</form>
关于php - PHP:如何在<form name =“form1”/>中获取名称值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4003300/