Re: $_POST array order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/14/07, Tim <user@xxxxxxxxxxxxx> wrote:
Hi,

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)?

I would like to array_pop($_POST) to get rid of that last element for
various reasons (validation scheme) later on..

Regards,

Tim
No, it isn't always the latest element, they are stored in the way the
were submit, and browsers like IE do this in order they are placed on
the page.
for example this form:
<form action='test.php' method='post'>
<input type='submit' name='submit' value='Go!'>
<input type='hidden' name='go' value='test'>
</form>
would return a $_POST array like this:
Array
(
   [submit] => Go!
   [go] => test
)
And so is submit the first element in the array and not the last one.

Tijnema

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux