RE: [PHP] $_POST array order
Another option would be to use an associative array: input type=text name=domain_object_vars[FirstName] value=/ . . . . input type=text name=domain_object_vars[Zip] value= This way the 'submit' button wouldn't even show up as a key in the array, which is accessible to PHP through the $domain_object_vars array. Best regards, Mike Weaver -- Michael Weaver Founder/Chief Facilitator Dynamic Insight Innovation through Communication Tel: 1.814.574.4871 Email: [EMAIL PROTECTED] Email: [EMAIL PROTECTED] (high-capacity) AIM: dynamicinsight The information in this email and subsequent attachments may contain confidential information that is intended solely for the attention and use of the named addressee(s). This message or any part thereof must not be disclosed, copied, distributed or retained by any person without authorization from the addressee. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
RE: [PHP] $_POST array order
-Original Message- From: Tim [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 12:58 PM To: 'PHP' Subject: [PHP] $_POST array order 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php You could also omit the name parameter of the submit button and it will not even be passed at all. input type=submit value= Submit Form -B -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] $_POST array order
On 3/14/07, Tim [EMAIL PROTECTED] 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
Re: [PHP] $_POST array order
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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_POST array order
On Wed, March 14, 2007 12:28 pm, Brad Fuller wrote: You could also omit the name parameter of the submit button and it will not even be passed at all. input type=submit value= Submit Form I dunno about these new-fangled browsers, but in the old ones, you'd get Submit as the name if the user clicked on the button, and nothing if they just hit enter in a form field... -- 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? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $_POST array order
On Wed, 2007-03-14 at 17:23 -0500, Richard Lynch wrote: On Wed, March 14, 2007 12:28 pm, Brad Fuller wrote: You could also omit the name parameter of the submit button and it will not even be passed at all. input type=submit value= Submit Form I dunno about these new-fangled browsers, but in the old ones, you'd get Submit as the name if the user clicked on the button, and nothing if they just hit enter in a form field... Can't rely on that these days. Don't remember which, but at least one of them sends the first encountered submit button. Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php