Re: Perhaps an incomplete $_POST

From: Date: Wed, 29 Aug 2007 19:46:19 +0000
Subject: Re: Perhaps an incomplete $_POST
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-261510@lists.php.net to get a copy of this message
Yep, the form name is never submitted with the form info. However, the submit button will be submitted along. So, as an alternative, you could name the submit button in a way to recognize the submitted form: <form name="foo"> ... <input type="submit" name="fooSubmitBtn" ...> </form> Ludo
To the best of my knowledge, the "name" attribute of the FORM tag is never submitted with the request, whether it be GET or POST. It's there for client-side scripting (JavaScript, etc.) only. One trick that might help you - if your form action is POST, add a querystring to the action, something like "foo.php?formname=foo", then check $_GET['formname']. Of course, it might be just as easy to drop in a hidden input instead. Hope this helps. On 8/29/07, Jay Blanchard <jblanchard@pocket.com> wrote:
I just noticed something a little odd, and maybe there is a simple solution. Given a form; <form name="foo" action="foo.php" method="POST"> The attributes, especially the name "foo", never appear in any variables array. I am thinking that this might be handy to have for several reasons when processing the form. I have several reasons for needing the information, does anyone know how to get this in the processing script without having to add hidden fields or do some Ajax magic?
    


« previous php.general (#261510) next »