Checkboxes - how to process results

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm not sure which part needs fixing - consider all of it fair game
for suggestions.

I'm working on a site that allows users to select a postcard to mail.
They can also select a predefined note to place on the postcard. Not
all notes go will all postcards.

So - I have 3 tables: cards with cardID, cardDesc, cardFront,
cardBack, cardActive, notes with noteID, noteDesc, noteImage,
noteActive and finally I have cardnote with just cardID and noteID -
showing the pairs that work together.

My problem shows up in the notes admin area. I currently build a list
of potential cards to select from with checkboxes named by cardID.
When the form is submitted, I end up with an unknown number of
"[104]=>on, [147]=>on, [116]=>on" in my POST results - depending on
how many cards they figured this note works with. (I can't just check
for "on"s as the cardActive setting is also presented as a checkbox...
at least for now.)

If I'm working with note 117 at the moment, I need to insert the pairs
(104, 117), (147, 117) (116, 117) into cardnote.  

I could use some help with the "right" way to handle this. I'm unsure
if I need to change the way it's presented on the web page, or the way
I have it stored in the database or just some more advanced php
handling of what's already there.


Re: Checkboxes - how to process results

I accidently clicked wrong and an incomple reply may have been entered.

My suggestion is this:
Have all the cards have checkboxes.  Immediately to the right of each
card checkbox would be a dropdown options list with all the applicable
cards.  This list would be the result of a sql query over the third
table of yours.

That way there is no confusion.  He checks a box and can select what he
wants.  The drop downs can all have the same name with different
indexes that match the indexes for the checkboxes of cards chosen.

Coding would be easier and it is less confusing to the user.

Just a suggestion.


Re: Checkboxes - how to process results

That should have said a dropdown list of applicable notes.

Quoted text here. Click to load it

Site Timeline