By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,473 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

Dynamic Values for DropDowns

P: 4
I have a page with all form field to take input from user.
ex : when user selects a Country automatically all the states within that country should be populated in second list box with values(states) fetched from database.
and if I select state again all the cities under this state would appear in 3rd drop down.. like that...

I know Ajax will do this thing.. But can anyone point me to the sample code..
Sep 27 '12 #1
Share this Question
Share on Google+
5 Replies

P: 3
What platform are you working with? .NET, PHP, Other?
Sep 27 '12 #2

P: 4
am using Perl/CGI. Can you point to me some sample code for this purpose?

Thanks a bunch!
Sep 27 '12 #3

P: 273
i think best to use ajax or java script as passing values to perl or cgi.
Sep 27 '12 #4

P: 4
Thanks Fary4u for ur reply. Do you have some simple/sample code to show in for the same? I searched in web but all are confusing for a beginner like me.
Sep 27 '12 #5

P: 273
give you idea to start with is.
Expand|Select|Wrap|Line Numbers
  1. <SCRIPT>
  2. function checkLink(s) {
  3. var val = escape(s)
  4. var val = form1.dropdown.options[form1.dropdown.options.selectedIndex].value;
  5. </script>
you can write like this.
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("result").innerHTML = val;
Sep 27 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.