Page 1 of 1
dynamic drop down menu
Posted: Wed Apr 21, 2010 7:05 pm
by Shamma
hi there
I have a drop down menu which I retreive from DB. at the end of the options I added 'other'. --> when the user selects other option I want another drop down menu to be created to me and retreived data from DB as well.
how can I do that
thanks
Re: dynamic drop down menu
Posted: Wed Apr 21, 2010 11:55 pm
by califdon
If you have to retrieve more data from the server, you will have to use AJAX, the Javascript way to get data from the server without loading a new html page. Google for javascript ajax and you will find loads of info.
Re: dynamic drop down menu
Posted: Thu Apr 22, 2010 3:48 am
by Shamma
yes I know it is not effecient and I know AJAX is better, but I can't go for ajax cause I am not using ASP.NET .. I am just using simple HTML
I need any simple code for that, I google it and there is nothing useful
Re: dynamic drop down menu
Posted: Thu Apr 22, 2010 1:25 pm
by califdon
Shamma wrote:yes I know it is not effecient and I know AJAX is better, but I can't go for ajax cause I am not using ASP.NET .. I am just using simple HTML
I need any simple code for that, I google it and there is nothing useful
I said nothing about being efficient or that AJAX is better than something else. AJAX also has nothing whatsoever to do with ASP.NET.
If you don't use Javascript, it is impossible to do
anything based on what the user chooses in a dropdown list. HTML does nothing beyond
displaying the page. AJAX is just Javascript, but it relies on there being a server-side script to respond with the required data. Server-side scripts would be PHP, Perl, or VBScript (if you are using a Microsoft web server).
Re: dynamic drop down menu
Posted: Fri Apr 23, 2010 5:39 am
by Shamma
ok, I am using javascript to validate inputs and to store them in cookies. I am using a php lanuage as well
Can you give me a good example then of how to generate a dynamic drop down menu ?
Re: dynamic drop down menu
Posted: Fri Apr 23, 2010 1:25 pm
by califdon
Here is a thorough tutorial on doing exactly what you asked about:
http://www.webmonkey.com/2010/02/build_ ... down_menu/
I am happy to provide the link to you, but for your future reference, all I did was Google
ajax tutorial dropdown and pick the first result I found. If you will learn to do this, you will usually find answers to your questions much faster than in a forum like this.
Good luck with your project.