Bonjour à tous !
J'ai dégotté un script permettant de géolocaliser un lieux sur GGmap depuis son adresse. MAIS : je souhaiterais que cette carte soit générée dynamiquement depuis une requête php. Pour cela il faudrait que la variable address récupère une variable php...

Euhm je suis débutant ! Comment j'intègre du php dans du javascript ?!
Je crois qu'on peut pas ? Quelle solution pour contourner ?

MERCI !!

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php include("bd.php");
 
mysql_select_db($database_bdS, $bdS);
$query_prestat = "SELECT * FROM prestat WHERE id = '38'";
$prestat = mysql_query($query_prestat, $bdS) or die(mysql_error());
$row_prestat = mysql_fetch_assoc($prestat);
 
$address = $row_prestat['nom'];
 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAA0Md2rvRkMi31Eel2ZVu-xT4PMegzlW1M4h2LYGn0xRZHedNRhT8-QaK9cZHqyUQSGq-1NwjLIXPDA"
      type="text/javascript"></script>
    <script type="text/javascript">
 
    var map = null;
    var geocoder = null;
 
    function initialize() {
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        geocoder = new GClientGeocoder();
		var address = "ADRESSE EN QUESTION";
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 13);
              var marker = new GMarker(point);
              map.addOverlay(marker);
              marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }
 
</script>
</head>
 
<body onload="initialize()" onunload="GUnload()">
  <div id="map_canvas" style="width: 500px; height: 300px"></div>
</body>
</html>