Php google map application instance code

Source: Internet
Author: User

Php tutorial google map app instance code
Function selected ($ param, $ value ){
If ($ param = $ value) print "SELECTED ";
}

# Collect any form data to control the display

$ Scale = 10;
$ Maptype = "G_NORMAL_MAP ";
If ($ _ REQUEST [scale]) $ scale = $ _ REQUEST [scale];
If ($ _ REQUEST [maptype]) $ maptype = $ _ REQUEST [maptype];

# Geocoding your location
# Note-you wocould cache this in a file
# The key is domain specific-your google maps tutorial key

/*
$ Location = file ("http://maps.google.com/maps/geo? Q = 48 + Spa + Road, + Melksham, + UK &
Output = csv & key = ABQIAAAAvp3 _ HwvT3VkixIIbsW0axQuKI_6t1bH2P0vCI_Q8jfpn8qdNBQMnnelj
Xh9czilkau_bYSCXteS_A ");
*/
# Following line is hard coded for demo
$ Location [0] = "51.369318, 2.133457 ";
List ($ stat, $ acc, $ north, $ east) = explode (",", $ location [0]);

?>

<Html>
<Head>
<Title> Well House Manor, Melksham </title>
<Script src = "http://maps.google.com/maps? File = api & amp; v = 2 & amp;
Key = ABQIAAAAvp3 _ prop _
BYSCXteS_A"
Type = "text/javascript tutorial"> </script>
<Script type = "text/javascript">

// <! [CDATA [

Function load (){
If (GBrowserIsCompatible ()){
Var map = new GMap2 (document. getElementById ("map "));
Map. setCenter (new GLatLng (51.36905,-2.1335), <? = $ Scale?> );
Map. setMapType (<? = $ Maptype?> );
Var manor = new GLatLng (<? = $ North?> , <? = $ East?> );
Map. addOverlay (new GMarker (manor ));

}
}

//]>
</Script>
</Head>
<Body onLoad = "load ()" onUnload = "GUnload ()">
<Table> <tr valign = top> <td>
<H1> Well House Manor, Melksham <br>
& Bull; Business Hotel in Melksham <br>
& Bull; All rooms fitted to superior standard <br>
& Bull; Internet Access throughout <br>
& Bull; Plenty of parking and close to town center <br>
<A href = http://www.wellhousemanor.co.uk> Well House
Manor website </a> <Form method = POST> Change
<Select name = scale>
<Option value = 7 <? = Selected ($ scale, 7)?> > Overview </option>
<Option value = 10 <? = Selected ($ scale, 10)?> > County </option>
<Option value = 13 <? = Selected ($ scale, 13)?> > Town </option>
<Option value = 16 <? = Selected ($ scale, 16)?> > Street </option>
<Option value = 19 <? = Selected ($ scale, 19)?> > Building </option>
</Select>
<Select name = maptype>
<Option value = G_NORMAL_MAP <? = Selected ($ maptype, "G_NORMAL_MAP")?> >
Normal map </option>
<Option value = G_SATELLITE_MAP <? = Selected ($ maptype, "G_SATELLITE_MAP")?> >
Satellite data </option>
<Option value = G_HYBRID_MAP <? = Selected ($ maptype, "G_HYBRID_MAP")?> >
Hybrid </option>
</Select>
<Input type = submit value = "go! "> </Form> <br>
This is a sample PHP page with Google Maps <br>
Teach you how to write pages like this </a> <br>
Date-<? = Date ("F, jS l Y")?> <Br>

</Td> <td>
<Div id = "map" style = "width: pixel PX; height: 550px" </div>
</Td> </tr> </table>
</Body>
</Html>

 


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.