Selection forms

G

guitarromantic

Hey everyone,

I maintain a music review site and have a php form to submit data to
our database. I have a dropdown form box with all our writers on
(selected from the database) and the selected value is stored in the
database for each review.. straightforward.

However, we also do multi-author reviews. I normally just use the
"Multiple" profile, but this then means in lists of reviews by authors,
their multiple ones don't show up. I could hack a way around this but
frankly it'd be better for the site if I could associate a review with
multiple authors. I figure I can do this, so I need a way of making an
appropriate form.

Basically, I want to have two form fields: the aforementioned select
field with a list of all staff, with a "Add" button next to it, which
then adds that user's ID to a second field marked "reviewers", followed
by a comma. I'm evidently no javascript scholar, so can anyone point me
in the right direction?

Matt
 
T

tim

Hey everyone,

I maintain a music review site and have a php form to submit data to
our database. I have a dropdown form box with all our writers on
(selected from the database) and the selected value is stored in the
database for each review.. straightforward.

However, we also do multi-author reviews. I normally just use the
"Multiple" profile, but this then means in lists of reviews by authors,
their multiple ones don't show up. I could hack a way around this but
frankly it'd be better for the site if I could associate a review with
multiple authors. I figure I can do this, so I need a way of making an
appropriate form.

Basically, I want to have two form fields: the aforementioned select
field with a list of all staff, with a "Add" button next to it, which
then adds that user's ID to a second field marked "reviewers", followed
by a comma. I'm evidently no javascript scholar, so can anyone point me
in the right direction?

Matt

Hi Matt

Have you considered using a multiple select box instead of using
javascript?

Tim
 
G

guitarromantic

That never occured to me! Would I still be able to store values in the
format "1,2,3" though using that method? I plan to then explode these
values at the comma into an array in my database stuff so I can display
each individual author's details.
 
D

David Dorward

That never occured to me!

What didn't?

http://cfaj.freeshell.org/google/
Would I still be able to store values in the format "1,2,3" though using
that method?

Once the data gets to your server you can store it in whatever way you like,
although using a database table that has two columns (author table id,
article table id) is the more usual way to do it (and makes it easy to look
things up from either direction).
 
G

guitarromantic

David said:

Sorry - I wish Google would default to quoting when replying.
Once the data gets to your server you can store it in whatever way you like,
although using a database table that has two columns (author table id,
article table id) is the more usual way to do it (and makes it easy to look
things up from either direction).

This is how I have it setup now, it's a little tricky to explain. I've
been playing around, looks like this is the wrong group really, I need
to get php/mysql to store an array of my selected author_ids from the
list - thanks for the tips though!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,099
Messages
2,570,626
Members
47,237
Latest member
David123

Latest Threads

Top