Re: order of elements in $_POST super global

From: Date: Thu, 08 Jun 2006 15:05:15 +0000
Subject: Re: order of elements in $_POST super global
References: 1  Groups: php.general php.general 
Request: Send a blank email to php-general+get-237624@lists.php.net to get a copy of this message
Ben Liu schrieb:
Hello All, I'm using a form (method="POST") to collect 30 boolean values from the end user using a series of checkboxes in the form. The form is arranged in a table so that the 30 check boxes are not a long list but rather three columns (with related items columnized). The problem is when I iterate through the $_POST results: The order in which I wish to present the checkboxes to the end user is different than the order I want to have in the $_POST super global and subsequently when I dump that information out to a text file. What would be the best way to solve this? 1) Is there a way to present the checkboxes in a certain order, yet have the data transmitted into the $_POST super global in a different order? 2) Does it make more sense to process the $_POST super global array and reorder the items within the array? 3) Some other method? Thanks for any advice. - Ben 1. Use Keys in your form like a[1],a[2]
2. order the array by usort (alphabetically or whatever u prefer) that way => 2: yes it is. -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

« previous php.general (#237624) next »