Jalsemgeest Posted May 31, 2012 Share Posted May 31, 2012 Hi everyone, I'm fairly new to php although I am beginning to understand it fairly coherently. What I'm having trouble with is something I'm doing for a website I'm making with some friends. What I need is a List Box, preferably a single select box. This box must be populated from information from a MySQL database. I don't want any information built into the site (which is what many of the tutorials online are doing). When a selection is made on the single-select List Box I would like for it to open up open up a Multi-Select List Box beside it with information that is being pulled from the MySQL Database as well. Then when selections are made within that box have a "Message" Button appear beside it. (The button could be there the whole time... doesn't really matter that much...) I understand I need to be using JavaScript, Ajax, PHP and MySQL for this to work as effectively as possible. Please let me know and if possible be as detailed as possible. Thank you very much, Cheers. Quote Link to comment Share on other sites More sharing options...
Psycho Posted May 31, 2012 Share Posted May 31, 2012 This forum is for people to get help with code they have written. What you are asking for requires several different implementations working together. It is unrealistic to expect a complete solution to be explained in a forum post. Do one thing at a time and get it working then move to the next. If you have problems with something then post a question on exactly what you are trying to do and the problems you are experiencing. I would the following: Start by creating the first select list. This would require a simple SELECT query and processing the results into OPTION tags. Then, implement JQuery to do the client side logic. Just start with implementing an alert() when an option is selected. Then have it perform an AJAX call (passing the select list value) to a dummy PHP page that only echo's back the passed value and have the alert() display the value passed back from AJAX call. Then, build the PHP page to take the passed value to query the values for the second select list and pass those values back. Lastly, modify the PHP output to build the results into the secondary multi-select list and pass that back. The JS can then populate that secondary multi-select listbox onto the page. 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.