-
how to show state when country is selected
how to show state when country is selected in combo box? i have done for the all state in malaysia. it is very hard to put the all state for all country. any idea how to do it? below is what i done.
http://www.my-advertisement.com/signUp.php
-
-
Seems like you're doing fine. Just do that for each. I didn't look at the code, but if it pops up for one, just repeat for each.
Yes, it will be long and tedious code, but that's just what will need to be used.
Another option here is that you could use Ajax to get the info for the states based on the selected country, but this would be a good bit of effort as ajax is kinda complex.
I'd just setup an external .js file defining variables (arrays, actually) of each state within the array "that country".
Then just use some JS to write the code and you're set.
Just like you couldn't do a math problem with half the numbers, there's no real way around just listing all of the states.
This is also very much javascript due to live interaction, and not at all related to PHP as it can't operate live on the page.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
Thanks for your reply.
If i continue to do that, it will need a lot of time.
Anyone had done it can share at here?
Thanks
-
-
Indeed. It takes time to list all the states in every country. Better get going on it.
And just for the record "my-advertisement.com" is not very appealing to me as something i'd like to help.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
-
Actually i have saw the website that can list out the state for the selected country last time, but i can't remember the URL. Anyway thanks for your advice.
What do u mean by the 2nd paragraph? You wan to help me on the system interface design?
We are welcome any suggestion n help.
-
-
anyone have done it before?
if yes, can u post to here?
thanks.
-
-
-
-
What I meant is that "my-advertisement.com" sounds like the type of commercial website that would annoy me on as I browse the web, so it isn't on the top of my lists to help.
As for the problem, I still don't have any good solutions.
Even if you found a page with the script, it would be copyrighted, so just copying it would be illegal unless you had permission.
In the end, the best way is to do it yourself.
I'd suggest looking at the official government webpages, hoping to find a list of all countries and the states (or similar divisions) within.
What I would further recommend would be looking into writing a script (in anything from Javascript to PHP to C++) that would allow for taking a list with one state per line and automatically generating the javascript code for you, which could save a lot of time.
Or, perhaps a better option would be to actually write a script for your webpage in javascript that could take a list of states and parse it into options. This is possible, and you could have an onChange="" attribute in the country list to find the list of states for the current value of the list.
That would save a lot of explicitly written-out code, which would be replaced with just lists for each country which would then be made into a dropdown menu once the user selects a country.
Daniel -
Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks