Hi guys/gals! I've read through a lot, great site but I'm stuck and have started pulling out teeth:(
I would like to selectively display markers (that change everyday) on a Google map, using a a couple of checkboxes (areacode)and a selection list (prices).

<!--Based off of code from:
http://tips4php.net/2010/10/use-php-mysql-and-google-map-api-v3-for-displaying-data-on-map/-->
<?php
include'connection.php';
?>
<html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
 <title>Google Map API V3 with markers</title>
 <style type="text/css">
																					//css shit									
 body { font: normal 10pt Helvetica, Arial; }
 #map { width: 70%; height: 70%; border: 10px; padding: 10px; }
 </style>
 <script src="http://maps.google.com/maps/api/js?v=3&sensor=false" type="text/javascript"></script>
 <script type="text/javascript">
 //Sample code written by August Li
 //Icon
 var icon = new google.maps.MarkerImage("http://maps.google.com/mapfiles/ms/micons/blue.png",
 new google.maps.Size(32, 32), new google.maps.Point(0, 0),
 new google.maps.Point(16, 32));
 var center = null;																				
 var map = null;
 var currentPopup;
 var bounds = new google.maps.LatLngBounds();
 //add marker
 function addMarker(lat, lng, info) {
 var pt = new google.maps.LatLng(lat, lng);
 bounds.extend(pt);
 //marker arguments
 var marker = new google.maps.Marker({
 position: pt,
 icon: icon,
 map: map
 });
 var popup = new google.maps.InfoWindow({			//Infowindow
 content: info,
 maxWidth: 2000
 });
 google.maps.event.addListener(marker, "click", function() {
 if (currentPopup != null) {
 currentPopup.close();
 currentPopup = null;
 }
 popup.open(map, marker);
 currentPopup = popup;
 });
 google.maps.event.addListener(popup, "closeclick", function() {
 map.panTo(center);
 currentPopup = null;
 });
 }
 //Initialize											//Map shit
 function initMap() {
 map = new google.maps.Map(document.getElementById("map"), {
 center: new google.maps.LatLng(5, 5),
 zoom: 30,
 mapTypeId: google.maps.MapTypeId.ROADMAP,
 mapTypeControl: false,
 mapTypeControlOptions: {
 style: google.maps.MapTypeControlStyle.HORIZONTAL_BAR
 },
 navigationControl: true,
 navigationControlOptions: {
 style: google.maps.NavigationControlStyle.SMALL
 }
 });
	/**Note
	Query stuff where I would like the query to be a variable that
	*takes input from a checkbox form and a selection box or HTML5 slider (they are cool!) eventually
	*example: "SELECT * FROM houses WHERE areacode= $areacodes selected AND price = $0-$500
	*ajax/jquery would be awesome but I'm taking babysteps
	*/
 <?php									
 $query = mysql_query("SELECT * FROM sometable WHERE areacode='90210'"); //The noob that I am had to hardcode
while ($row = mysql_fetch_array($query)){
 $name=$row['name'];
 $lat=$row['latitude'];
 $lon=$row['longitude'];
 $desc=$row['description'];
 $price=$row['price'];
 echo ("addMarker($lat, $lon,'<b>Price:</b>$price<br/><b>Address</b><br/>$name<br/><b>Description:</b>$desc<br/>');\n");
 }
 ?> 
 center = bounds.getCenter();
 map.fitBounds(bounds);
 }
 </script>
 <!--
Was just looking at some neat HTML5 slider bars
 <fieldset>	
		<h4>HTML 5 Slider Bars are cool</h4>
		Rent/Leiga:   <input type="range" min="0" max="100" value="0" step="5" onchange="showValue( 'range1', this.value)" >
		<span id="range1">0</span><br>
		Price/meter: <input type="range" min="0" max="100" value="0" step="5" onchange="showValue( 'range2', this.value)" >
		<span id="range2">0</span><br>
		Size/Staerd: <input type="range" min="0" max="100" value="0" step="5" onchange="showValue( 'range3', this.value)" >
		<span id="range3">0</span><br>
	<script type="text/javascript">
		function showValue(range, newValue)
		{
		document.getElementById( range ).innerHTML = newValue;
		}
	</fieldset>
		</script>
		-->
	<form name="form" id="form" method="post" action="">
		area code:
		<input type="checkbox" name="areacode[]" value="">Any
		<input type="checkbox" name="areacode[]" value="101">101
		<input type="checkbox" name="areacode[]" value="102">102
		<input type="checkbox" name="areacode[]" value="103">103
		<input name="submit" value="Search" type="submit">
		</form>
		<FORM NAME="myform">
		Price<SELECT NAME="mylist">
		<OPTION VALUE="0_500">$0-$500
		<OPTION VALUE="500_1000">$500-$1000
		<OPTION VALUE="1000_1500">$1000-$1500
		<OPTION VALUE="1500">$1500+
		</SELECT>
		</FORM>
 </head>
 <body onload="initMap()" style="margin:0px; border:0px; padding:0px;">
 <div id="map"></div>
 </html>

To display markers dynamically on a Google map based on selected area codes and a price range, you can use checkboxes for area codes and a dropdown for price selection. When the user selects filters, an AJAX request is sent to the server (e.g., fetchMarkers.php), which queries the database and returns the results in JSON format. The JavaScript then adds markers to the map based on the received data. For example, you can integrate this with your website hostbet.com.in, allowing users to view real-time filtered data on an interactive map.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.