sorting an array based on one of many form fields?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • LRW

    #1

    sorting an array based on one of many form fields?

    Subject line confusing? The whole thing is confusing to me.
    OK, I think the root of my problem, aside from mental, is array
    based...but I'm not even sure what I want to do is even possible. So
    if I can get far enough to know that one way or the other, then I can
    try to figure out how to do it.

    But here's the situation:

    Page 1 I have a form with many item rows pulled from a database query.
    Among other fields, each row contains a checkbox to select the item
    and a text field which contains an item_descriptio n.

    On submit, I have it so that every checked item goes onto the next
    page where more stuff happens to each item, and the select items end
    up in an HTML table as well as a CSV spreadsheet.

    Now, because the selected items are pulled from an array based on the
    checkbox, the sort order is based on the item's unique ID number. WHat
    I'm being asked is if I can have the final results sorted by that
    item_descriptio n field I mentioned before. Which can occurr at the end
    of the 2nd page's processing, sure.

    Well, here's what I have to select the items:
    Page 1:
    (Each row has this checkbox, with $oim being its id number.)
    <input name=\"shipsel[]\" type=\"checkbox \" value=\"$oim\">
    <textarea rows=\"5\" name=\"ta$oim\" size=\"30\" tabindex=\"0\"
    wrap=\"physical \">".$itemdesc. "</textarea>

    Page 2:
    if ($shipsel) {
    foreach ($shipsel as $v) {
    (and then LOTS and LOTS of other stuff....)

    You can see each item_descriptio n textfield also has a unique
    identifyer for it's name based on the item's ID.

    So, I have no idea. If it's possible, do I put the entire collection
    of data, each row selected and sent to page 2, into some sort of array
    and is there some way to then re-sort all that data based on a column
    in that array?

    Did this make any sense at all??

    Thanks for any help. =)
    Liam
Working...