php - Drupal 6 Location Module get city name using zip code


I am using Location module and enabled Location CCK field. While creating content I am just collecting zip/postal code and country. I want to display the City name using the zip/postal code associated with node.

I know Location module comes with zip code database. Is there need to query this zip/postal code database to get City name? If that zip/postal code is not available then what could be solution?

Please guide me how could I achieve this?




Part of it has been resolved. This could be helpful for others. You can get zip/postal code information by the function available in the location module i.e. location_get_postalcode_data which accept Location parameter as array

@param $location
 *   Array. the location data
 *   -> the values are:
 *     'street'         => the string representing the street location (REQUIRED)
 *     'additional'     => the string representing the additional street location portion in the location form
 *     'city'           => the city name (REQUIRED)
 *     'province'       => the province code defined in the country-specific include file
 *     'country'        => the lower-case of the two-letter ISO code (REQUIRED)
 *     'postal_code'    => the postal-code (REQUIRED)

Also I did some modification in my country specific .inc file available in supported directory to fetch extra information along with default lat-lon info.

But second part if zip/postal code not available in database then is pending.




public function 

    #   get and output "<Result>" elements
    foreach ($result as $val)
        return $null;

People are also looking for solutions to the problem: header function not working in php after setting session


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.