Re: [PHP] Perhaps an incomplete $_POST



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@xxxxxxxxxx> 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?

.


Quantcast