Salut tout le monde
Je ne réussis pas en envoyer ma selection de mon menu deroulant vers mon PHP (qui attend) la variable (villa) pour generer mon XML
Actuellement tout mon SQL est generer en XML sans filtre... Voici mon HTML
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
$("form[name=form1] select").change( function(){
					eval (removema())
 
 
					var valeur = $("select").val();				
					if ( valeur != "Laurentide" ){
 
						$.ajax({
							type: "POST",
							url: "phpsqlajax_lannon2.php",
							data: "lannon2.xml",
							success: function markerz(data){
								var markers = data.documentElement.getElementsByTagName("lannon2");
								for (var i = 0; i < markers.length; i++) {
								var latlng = new google.maps.LatLng(
								parseFloat(markers[i].getAttribute("lat")),
								parseFloat(markers[i].getAttribute("lng")));
								var marker = new google.maps.Marker({position: latlng, map: map});
								markerx.push(marker);
 
								};
							}
						});
					}else{
						map.setCenter(new google.maps.LatLng(45.671794,-73.87739));
						map.setMapTypeId(google.maps.MapTypeId.TERRAIN);
						map.setZoom(13);
					}
				});
})
 
 
  </script>
 
  </head>
 
 <body>
<div id="map_canvas" style="width: 760px; height: 480px;"></div>
 
<form method="POST" action="" name="form1">
<select name="villa" style="font-size: 12px;">
		<option>Laurentide</option>
		<option>Montreal</option>
		<option>Laval</option>
 
		</select>
</form>
et mon PHP
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
52
53
54
55
<?php
require("phpsqlajax_dbinfoz.php");
 
function parseToXML($htmlStr) 
{ 
$xmlStr=str_replace('<','&lt;',$htmlStr); 
$xmlStr=str_replace('>','&gt;',$xmlStr); 
$xmlStr=str_replace('"','&quot;',$xmlStr); 
$xmlStr=str_replace("'",''',$xmlStr); 
$xmlStr=str_replace("&",'&amp;',$xmlStr); 
return $xmlStr; 
} 
 
// Opens a connection to a MySQL server
$connection=mysql_connect ($dbhost, $dbuser, $dbpass);
if (!$connection) {
  die('Not connected : ' . mysql_error());
}
 
// Set the active MySQL database
$db_selected = mysql_select_db($dbname, $connection);
if (!$db_selected) {
  die ('Can\'t use db : ' . mysql_error());
}
 
// Select all the rows in the ddwebdev_chemin table
$query = "SELECT * FROM lannon2 WHERE ville LIKE '%".$POST['villa']."%'";
$result = mysql_query($query);
if (!$result) {
  die('Invalido query: ' . mysql_error());
}
 
header("Content-type: text/xml");
 
// Start XML file, echo parent node
echo '<chemin>';
 
// Iterate through the rows, printing XML nodes for each
while ($row = @mysql_fetch_assoc($result)){
  // ADD TO XML DOCUMENT NODE
  echo '<lannon2 ';
  echo 'id="' . $row['id'] . '" ';
  echo 'nom="' . $row['nom'] . '" ';
  echo 'address="' . $row['address'] . '" ';
  echo 'ville="' . $row['ville'] . '" ';
  echo 'lat="' . $row['lat'] . '" ';
  echo 'lng="' . $row['lng'] . '" ';
  echo 'type="' . $row['type'] . '" ';
  echo '/>';
}
 
// End XML file
echo '</chemin>';
 
?>
et voila mon site http://www.ma117.info/maptest524.html
Merci