Snippet Information
Version: 18 (latest)
Author: jeff
Language: php
Licensed under GNU LGPL v3
Other versions
Snippets included by
geocode_form v.18
Snippets that include
geocode_form v.18
None
"geocode_form" v.18 (latest)
Description
Geocodes a location provided in a form, and includes a Google Map. Uses geocode_fn
Run
| View code [+] |
Create a snippet based on this »
<?php include_snippet(1,'make_pretty'); ?> <form action="http://run.kogbox.com/php5/"> <label for="url">Enter any location:</label> <input type="text" name="location" value="<?php echo $_REQUEST['location'];?>" /> <input type="hidden" name="m" value="geocode_form" /> <input type="hidden" name="u" value="1" /> </form> <p>Ex: "Boulder, CO", "Turkmenistan"</p> <?php include_snippet(1,'geocode_fn'); if ($_REQUEST['location']) : $return = geocode($_REQUEST['location']); echo "<h2>".$_REQUEST['location'].":</h2>"; echo "Longitude: ".$return['Longitude']."<br />"; echo "Latitude: ".$return['Latitude']."<br /><br />"; $google = "Google Maps: <a href='http://maps.google.com/?ie=UTF8&ll=".$return['Latitude'].",".$return['Longitude']."&z=5' target='_blank'>Link</a>"; echo $google; ?> <br /><br /> <iframe width="600" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/?ie=UTF8&ll=<?php echo $return['Latitude']; ?>,<?php echo $return['Longitude'];?>&spn=0.009137,0.016072&z=5&om=1&output=embed&s=AARTsJqzARj-Z8VnW5pkPMLMmZbqrJcYpw"></iframe> <?php endif; ?> </body> </html>

Comments (0) | View comments for all versions (0)
Log in if you have a Kogbox account.