Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

post

php

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.

like image 634
StackOverflowNewbie Avatar asked Oct 23 '25 00:10

StackOverflowNewbie


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>
like image 60
Pekka Avatar answered Oct 24 '25 13:10

Pekka


<form name="wut">
    <input type="hidden" name="name" value="wut"/>
</form>
like image 25
Robus Avatar answered Oct 24 '25 15:10

Robus



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!