Implement Country and Province dropdown list in drupal 7 programmatically using Location module

StackOverflow https://stackoverflow.com/questions/16270929

  •  13-04-2022
  •  | 
  •  

Question

I am implementing a Drupal 7 signup form (through a custom module) where users should be able to indicate their location (Country + Province/State) using dropdown lists. From the description of Location module, this seems possible (by using APIs or someother way). I am new to Drupal and have no idea of how to implement this in the custom module programatically (using location module's APIs). I've googled about this for a couple of days, but couldn't make much progress.

Any sample code or leads would be greatly appreciated.

Thanks a Ton.

Was it helpful?

Solution 2

Ok I finally figured out how this is done. We just need to call the api function like here $country = array(location_get_provinces("us"));
This returns the provinces of the country which is supplied as a parameter.

OTHER TIPS

If location module provides what you what, you should use it. Otherwise try with address field module.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top