I'm not even sure this is possible, and if it is, I'm having a hard
time focusing on a function that would make it work.
What I have is a dynamically generated form with dozens of rows from a
mySQL query.
Each row in this form has a checkbox to select what rows the user
wants sent to the processing page.
Each row also has a slew of various text fields and dropdown menus
with data from the query and editable by the user.
The user checks the boxes to send on.
Then, on the process page, an array is created based on which
checkboxes are selected.
Now at the moment the process page processes each selected row on a
for-each in the order they were listed on the previous page.
Keeping the mySQL sort order the same as it is on the 1st page, is
there a way to resort the array on the process page so that the rows
are processed in a different order, based on one of the fields in the
array?
For example, each row has the following data:
checkbox value(which is also the row
id),firstname,lastname,address,size,color
And the array could have dozens of rows. Right now it's processed in
order of checkbox value because that's how it's sorted on page one.
What if I want to change the sort in the array by lastname before
processing?
Did that make any sense?
I looked up asort() and usort() and they LOOK like something that
might work...at least I understand what they're doing, but I'm not
sure if something like that would work in this complicated (maybe?) of
an array I have going.
And to be honest, I have no idea in my array what is the key (the
value of the checkbox selected?) and what happens when you have more
than 2 items in each row of the array?
If one of the ?sort() types IS what I need to look into, someone let
me know? If there's another concept that would work better, someone
clue me in?
I'd appreciate it!
Thanks,
Liam