Re: order of elements in $_POST super global
| From: | Ben Liu | Date: | Thu, 08 Jun 2006 15:11:42 +0000 |
| Subject: | Re: order of elements in $_POST super global | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-237626@lists.php.net to get a copy of this message | ||
Hi Dave,
No, that is definitely a possibility. Right now I am using a foreach
loop to iterate over the $_POST array and determine if each checkbox
is checked or not, if it is checked, than a related piece of data is
written into the text file. This makes for pretty compact code. I
could as you suggest, simply check each element in the array manually
using the associative keys rather than using a loop, that way I could
do it in any order I wished, but the code gets rather long with a line
for each checkbox. I anticipate this set of checkboxes/boolean
responses may increase in the future also, so having the loop allows
for some future-proofing.
- Ben
On 6/8/06, Dave Goodchild <buddhamagnet@gmail.com> wrote:
On 08/06/06, Ben Liu <blzabub8@gmail.com> wrote:
You can access the values in the $_POST array in any order, so if you know the checkbox names why not output them in the order you want? Or I am being dumb here?