Connecting Tech Pros Worldwide Forums | Help | Site Map

Selection forms

guitarromantic@gmail.com
Guest
 
Posts: n/a
#1: May 10 '06
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


tim
Guest
 
Posts: n/a
#2: May 10 '06

re: Selection forms



guitarromantic@gmail.com wrote:[color=blue]
> 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[/color]

Hi Matt

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

Tim

guitarromantic@gmail.com
Guest
 
Posts: n/a
#3: May 10 '06

re: Selection forms


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.

David Dorward
Guest
 
Posts: n/a
#4: May 10 '06

re: Selection forms


guitarromantic@gmail.com wrote:
[color=blue]
> That never occured to me![/color]

What didn't?

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

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).

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
guitarromantic@gmail.com
Guest
 
Posts: n/a
#5: May 10 '06

re: Selection forms


David Dorward wrote:
[color=blue]
> What didn't?
>
> http://cfaj.freeshell.org/google/[/color]

Sorry - I wish Google would default to quoting when replying.
[color=blue]
> 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).[/color]

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!

Closed Thread