<?php $location= $_POST['location_entered']; if (!empty($location)) { $url= 'https://maps.googleapis.com/maps/api/geocode/xml?address=' . urlencode($location); $xmlcontent= file_get_contents($url); $xmlload= simplexml_load_string($xmlcontent); $zipcode= $xmlload->result->address_component[7]->long_name; } ?> <form action="" method="POST"> Enter the location:

<?php echo "Zip code: $zipcode"; ?>