tmyonline Posted March 12, 2009 Share Posted March 12, 2009 Hi guys, I have two lists; list A on the left and list B on the right. List B is initially empty. List A contains many options for users to select from. So, list A allows multiple selects. When a user makes a selection or multiple selections from list A, s/he will click the right arrow button (>>) and they will appear on list B. Likewise, if s/he needs to remove an item, s/he will click the left arrow button (<<) to remove it from list B. This is done entirely in JavaScript using a third party code. Now, when the user clicks the submit button, these selected items from list B will be entered into a database on the server. This is where I'm not sure how to do it due to the interaction between JavaScript and PHP. Normally, suppose there is an input field like this: <input name="item_A" value="item_A" /> To check if item_A successfully submitted, I usually do: if (isset($_POST['item_A']) && $_POST['item_A'] != '') echo 'item A = ' . $_POST['item_A']; Anyway, you probably know what I'm getting at. I need to do the same kind of things for those items appeared on list B. Here's an option that I've been thinking of - I want to put in an "onsubmit" attribute, like: onsubmit="transferToServer();" But, in my JavaScript transferToServer() function, how do I really transfer the list B items to the server so that they will be stored in some array, such as $_POST ? If you have a better solution, please let me know. I appreciate your help and thanks a lot. Quote Link to comment Share on other sites More sharing options...
Psycho Posted March 12, 2009 Share Posted March 12, 2009 You're looking for an AJAX solution. Too much to try and detail in a forum post. Many tutorials out there. There is an AJAX forum here if you run into trouble. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.