I have a fairly complex problem I am trying to solve with no
luck.
I have a form for creating sponsors. On this form, the user
is given a series of checkboxes for selecting which page(s) they
would like the sponsor's advertisement to display on. This series
of checkboxes is being dynamically generated from a list of "page
names" which are listed in another table.
On submission, the selected check boxes are written to a list
which is stored under the sponsor's table in my database, with
"true" or "false" for the given pagename in the list: For example,
let's say I have the checkboxes "index" "localnews" and "sports."
Then, let's say I choose the first two. On submit, I loop over the
dynamically named checkboxes, append them to a list, which results
(in this example) with a list of "true,true,false."
What I need to do is this: On the index page, I need to
display all of the sponsors whose lists contain a "true" value in
the list position relative to the pagename. So, if "localnews" is
an order of "1" in the list, I need to check the 1st item of each
list in each sponsor's record to determine whether or not the first
list item is "true."
So, let's say I have two sponsors, Jack and John. Their
respective lists are as follows:
(Jack) true,true,false
(John) false,true,true
Now, let's say I am on the "localnews" page where the value
of local news in the boolean list is the 1st position (e.g., in
"true,true,false", the first "true" equals localnews). Somehow, I
need to figure out how to create an output that will check the 1st
position of Jack and John's lists, determining what the boolean
values in those positions are, and output the results (e.g., an
image for Jack, and nothing for John). Then, for each subsequent
page, I need to move down the list depending upon the list position
boolean equivalent of the pagename (e.g., "sports" =3,
"obituaries"=4, and so on).
Any ideas?