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.
-
There is not a single reason to get it. Why do you need that?Your Common Sense– Your Common Sense2010-10-23 09:41:18 +00:00Commented Oct 23, 2010 at 9:41
-
You can't think of a reason why one might want to know the name of a form?StackOverflowNewbie– StackOverflowNewbie2010-10-23 09:52:14 +00:00Commented Oct 23, 2010 at 9:52
-
possible duplicate of How to access the form's 'name' variable from PHPFluffeh– Fluffeh2014-05-08 08:34:58 +00:00Commented May 8, 2014 at 8:34
-
@YourCommonSense i myself do. When you have several forms pointing to the same action form to call.webs– webs2022-01-27 12:31:01 +00:00Commented Jan 27, 2022 at 12:31
-
@webs so your question is how to tell one form from another, not "how to get the name attrubute"Your Common Sense– Your Common Sense2022-01-27 12:39:38 +00:00Commented Jan 27, 2022 at 12:39
|
Show 1 more comment
2 Answers
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>