[PHP] Getting form name
I'm trying to get the name of a form. I tried the following code, but I guess the data in $_POST only contains data on the form elements that go inside the form tags, but not info from the form tag itself. Any suggestions on how to get the form name? ? foreach ($_POST as $key=$value) { echo $key . --- . $value . br; } echo hr; echo form name=\myForm\ action=\test.php\ method=\POST\ value=\AAA\$ echo input type=\text\ name=\textbox\; echo input name=\mySubmit\ type=\submit\; echo /form; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting form name
Hello, Tuesday, March 22, 2005, 5:13:50 PM, you wrote: jk I'm trying to get the name of a form. I tried the following code, but jk I guess the data in $_POST only contains data on the form elements jk that go inside the form tags, but not info from the form tag itself. jk Any suggestions on how to get the form name? Stick a hidden input field in your form that contains the name of it. You cannot extract it from any super-global, it's not passed in that way. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services I do not fear computers. I fear the lack of them. - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting form name
Hello j, Tuesday, March 22, 2005, 10:13:50 AM, you wrote: j I'm trying to get the name of a form. I tried the following code, j but I guess the data in $_POST only contains data on the form j elements that go inside the form tags, but not info from the form j tag itself. Any suggestions on how to get the form name? j echo form name=\myForm\ action=\test.php\ method=\POST\ value=\AAA\$ IIRC, form name is not sent by any browser, so it won't show up in POST / GET / COOKIES or anywhere else. The easiest way is to set a hidden field which contains that information.. i.e. input type=hidden name=formName value=myForm / -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.0.9.7 Return (pre-beta) under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting form name
Hi Is there a way I can get the name of the form that has been posted? Looking at the form vars I don't see a name var or such in there. TIA M@ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Getting form name
From: "Matt Williams" [EMAIL PROTECTED] Hi Is there a way I can get the name of the form that has been posted? Looking at the form vars I don't see a name var or such in there. TIA M@ The NAME attribute of the FORM element is intended for scripting purposes only. But you should be able to achieve the desired effect with a hidden INPUT element: form name="someform" method="POST" input type="hidden" name="formname" value="someform" /form Cheers Simon Garner -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Getting form name
Thanks Simon. You would have though as it there they would make it part of the form. thanks again. M@ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]