Ugh! I'm not sure where to begin on what seems to be an insurmountable problem?!
Okay, let me try and describe the issue...
I built a Private Message feature into my website, and it looks very similar to Yahoo Mail.
Everything works great, except for one last piece...
Next to each PM in my "Inbox", there is a check-box. The idea is that you "check" certain Messages, and then when you select an "Action" from a drop-down in the Header and click "Go", my script applies the "action" to every message you checked. (Pretty standard, right?!)
Now what I want to do, is make it so if a user checks the "Top Check-box" in the Header and clicks "Go", my script will apply the "action" (e.g. Mark as Unread") to every Message in my Inbox.
For the part of my script that does work - which is the ability to "check" certain Messages and have them updated - I am using an array in my Form and then passing it back to an UPDATE query.
This works fine.
But here is where I am dreadfully stuck...
1.) I found out that if there are 20 Messages, and I just "check" 5 of them, then my array is only passing the 5 (and not all 20)?!
2.) I tried creating another array, and populating it with the results directly from my SELECT query which populates the Inbox. The logic being, if I have 20 Messages in my Inbox, and populate this 2nd array with the 20 Message ID's, and then pass it back to my script via the $_POST array, then I would be able to run an UPDATE on all 20 Messages.
But I can't get this part working...
I am willing to post my code here, but maybe you guys could respond and let me know if what I have said so far makes sense, and if you think you can help...
One trick I've used is to create a type="hidden" <input> field to go along with each checkbox (since, as you've discovered, checkboxes only get posted if they are checked). I believe you want the checkboxes to come after their respective hidden fields, so that they overwrite the hidden fields if they are checked -- but I haven't done it in awhile, so you may have to experiment a bit ).
Another alternative would be simply to save the relevant data in the session data, probably as an array within the $_SESSION array.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation