Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> skrypt do formularza rejestracyjnego, kod pocztowy automatycznie wypełnianie pozostałych pól
uczeń php
post
Post #1





Grupa: Zarejestrowani
Postów: 159
Pomógł: 0
Dołączył: 8.01.2010

Ostrzeżenie: (0%)
-----


Szukam skryptu formularza rejestracyjnego, w którym po podaniu kodu pocztowego automatycznie by się wypełniały takie pola jak województwo, powiat i gmina oraz nazwa miejscowości. Dodatkowo chciałbym aby kod pocztowy był w formie dwa pola input myślnik trzy pola input. Proszę o szybko odpowiedź.
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
uczeń php
post
Post #2





Grupa: Zarejestrowani
Postów: 159
Pomógł: 0
Dołączył: 8.01.2010

Ostrzeżenie: (0%)
-----


ok tylko mam jeszcze jeden problem jak się wrzuci do adresu url http://maps.googleapis.com/maps/api/geocod...amp;sensor=true to następuje pobranie pliku z danymi formacie json tylko te dane wyświetlane w tym pobranym pliku są po polsku natomiast
  1. $dane = file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address={$_GET['kod_pocztowy']},+{$_GET['kraj']}&sensor=true");
to te dane są po angielsku. Przykład plik jsona pobrany na komupter zawartość:

{
"status": "OK",
"results": [ {
"types": [ "postal_code" ],
"formatted_address": "02-999 Warszawa, Polska",
"address_components": [ {
"long_name": "02-999",
"short_name": "02-999",
"types": [ "postal_code" ]
}, {
"long_name": "Wilanów",
"short_name": "Wilanów",
"types": [ "sublocality", "political" ]
}, {
"long_name": "Warszawa",
"short_name": "Warszawa",
"types": [ "locality", "political" ]
}, {
"long_name": "Warszawa",
"short_name": "Warszawa",
"types": [ "administrative_area_level_2", "political" ]
}, {
"long_name": "Mazowieckie",
"short_name": "Mazowieckie",
"types": [ "administrative_area_level_1", "political" ]
}, {
"long_name": "Polska",
"short_name": "PL",
"types": [ "country", "political" ]
} ],
"geometry": {
"location": {
"lat": 52.1608648,
"lng": 21.0795830
},
"location_type": "APPROXIMATE",
"viewport": {
"southwest": {
"lat": 52.1577172,
"lng": 21.0764354
},
"northeast": {
"lat": 52.1640125,
"lng": 21.0827306
}
},
"bounds": {
"southwest": {
"lat": 52.1592883,
"lng": 21.0777915
},
"northeast": {
"lat": 52.1624414,
"lng": 21.0813745
}
}
}
} ]
}
kod w php
  1. $dane = file_get_contents("http://maps.googleapis.com/maps/api/geocode/json?address={$_GET['kod_pocztowy']},+{$_GET['kraj']}&sensor=true");
  2.  
  3.  
  4.  
  5. $tab = json_decode($dane,true);
  6.  
  7. print_r($tab);

gdzie $_GET['kod_pocztowy'] = 02-999 i $_GET['kraj'] = poland
w przeglądarce daje o to taki wynik:

Array ( [status] => OK [results] => Array ( [0] => Array ( [types] => Array ( [0] => postal_code ) [formatted_address] => 02-999 Warsaw, Poland [address_components] => Array ( [0] => Array ( [long_name] => 02-999 [short_name] => 02-999 [types] => Array ( [0] => postal_code ) ) [1] => Array ( [long_name] => Wilanów [short_name] => Wilanów [types] => Array ( [0] => sublocality [1] => political ) ) [2] => Array ( [long_name] => Warsaw [short_name] => Warsaw [types] => Array ( [0] => locality [1] => political ) ) [3] => Array ( [long_name] => Warsaw [short_name] => Warsaw [types] => Array ( [0] => administrative_area_level_2 [1] => political ) ) [4] => Array ( [long_name] => Mazovia [short_name] => Mazovia [types] => Array ( [0] => administrative_area_level_1 [1] => political ) ) [5] => Array ( [long_name] => Poland [short_name] => PL [types] => Array ( [0] => country [1] => political ) ) ) [geometry] => Array ( [location] => Array ( [lat] => 52.1608648 [lng] => 21.079583 ) [location_type] => APPROXIMATE [viewport] => Array ( [southwest] => Array ( [lat] => 52.1577172 [lng] => 21.0764354 ) [northeast] => Array ( [lat] => 52.1640125 [lng] => 21.0827306 ) ) [bounds] => Array ( [southwest] => Array ( [lat] => 52.1592883 [lng] => 21.0777915 ) [northeast] => Array ( [lat] => 52.1624414 [lng] => 21.0813745 ) ) ) ) ) )

jak zrobić, żeby w przeglądarce też się wyświetliło Warszawa zamiast Warsaw ?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 14.10.2025 - 14:50