On Wednesday 01 October 2003 21:18, Greg Wiley wrote: > Apologies if this has been asked before but I couldn't find > anything on google or any of the PHP code sites that quite fits my > requirements. Here's the problem: > > I have a form which presents the user with a table of dates with > checkboxes for a three month period, e.g. > > Dec 7th 14th 21st 28th > am [ ] [ ] [ ] [ ] > pm [ ] [ ] [ ] [ ] > > Jan 4th 11th 18th 25th > am [ ] [ ] [ ] [ ] > pm [ ] [ ] [ ] [ ] > > Feb 1st 8th 15th 22nd 29th > am [ ] [ ] [ ] [ ] [ ] > pm [ ] [ ] [ ] [ ] [ ] > > When the user submits the form with any of the boxes checked I > want to have these sorted into date order. > > If I check Dec 28th am and pm, Jan 4th am and pm, Jan 18th am and > pm and Feb 15th am and pm then the order returned in the _POST is: > > Dec 28 am, Dec 28 pm, Jan 4 am, Jan 18 am, Jan 4 pm, Jan 18 pm, > Feb 15 am, Feb 15 pm > > This is, I believe, due to the order of the elements in the form. > I tried using tabindex to influence the order returned but to no > avail. So I'm now trying to do this in the php code that processes > the submission. There is no year info such that I could turn the > dates into timestamp and sort that way. Has anyone got any code > that can sort this correctly?
Incorporate whatever sorting info you need into the value of the checkbox. <input type="checkbox" name="Dec 28 am" value="<insert timestamp for Dec 28 or whatever>"> -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* leverage, n.: Even if someone doesn't care what the world thinks about them, they always hope their mother doesn't find out. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php