Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing data between 2 select boxes

Status
Not open for further replies.

Julzzey

Programmer
Sep 2, 2002
19
US
Hi!

I'm just wondering if there is an easier way to do this than the way I've thought of. On my page I have 2 boxes and I want it so that if something is selected in the 1st box(and the user hits submit) then that something appears in the 2nd box and no longer in the first and visa versa. The only way I know how to do this is to have 2 arrays (one for each box) that I add and delete from and then display their values in the select boxes. I don't think it will be too bad to implement that, but I didn't know if there was an easier way. Thanks!
 
I assume you're trying to create a way for a user to select items from "column A" and have them show up in "column B".

If that is the case, unless there are pre-selected options that should already appear in "column B", why populate it in the first place?

Want the best answers? Ask the best questions: TANSTAAFL!
 
I could do it in columns, but I'm thinking in boxes. Let's say that in box A I have a list of possible fruits, and then in box B I have a list of fruits that I'm going to add to my salad. So the user can click on oranges in box A and they disappear from box A and go to box B (along with a quantity). Then select another fruit and so on and so forth. However if they decide they don't want something in box B then they need to be able to select it and hit remove and it will go back to box A. Once everything is set then they can hit submit at the bottom and everything is saved in the database. If I didn't have to associate a quantity with each fruit I could just use the normal multiple select box, but I need to let the user say how many too. I hope that's a little more clear,

Thanks!!
 
yes because I need to get the quantity the user wants for each ingredient selected. I thought I'd just have a drop list of possible quantities that was default 1 and the user can change if wanted. Thanks for your help!!
 
Sounds like a chunk of javascript needed with OnFocus/LostFocus type submit and build up a temp table in your db then finally with the submit transfer the temp data to your master table ??

Sound sensible ?
probably need to pop open Dreamweaver for suggestions (I usually do).
Good Luck
Laurie.
 
i have done this with onchange event of the list box and onchange:document.form1.submit(), the php script handles the rest. anyone thought of other ways?

cheers!
nida
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top