Re: $_POST array order
| From: | Richard Lynch | Date: | Wed, 14 Mar 2007 22:22:05 +0000 |
| Subject: | Re: $_POST array order | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-250608@lists.php.net to get a copy of this message | ||
On Wed, March 14, 2007 11:58 am, Tim wrote:
> Quick question regarding $_POST array element order, first the
> situation:
>
> I am submitting a form with x first fields and the post value returns
> the
> last element as being the submit button name and value
>
> Is it safe to consider that the last element in the $_POST array will
> ALWAYS
> be the submit element (it is always last in form)?
Sorry, no.
The HTTP spec specifically allows the browser to order the args in any
way it likes.
> I would like to array_pop($_POST) to get rid of that last element for
> various reasons (validation scheme) later on..
Would be better to always prepend button name with "button_" or
something, so you can walk the keys of $_POST and strip them out.
>
> Regards,
>
> Tim
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?