PHP: How to get name value in <form name=“form1” />

帅比萌擦擦* 提交于 2020-01-15 04:25:18

问题


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.


回答1:


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.

No, the form's name attribute is never set to sent to the server as part of the POST data.

The easiest way around this would be adding a hidden form element <input type="hidden"> containing the name.

<form name="myform" method="post" action="" enctype="multipart/form-data">
    <input type="hidden" name="frmname" value=""/>
</form>



回答2:


<form name="wut">
    <input type="hidden" name="name" value="wut"/>
</form>


来源:https://stackoverflow.com/questions/4003300/php-how-to-get-name-value-in-form-name-form1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!