FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » input country name and query database to output google map
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
input country name and query database to output google map [message #174260] Sun, 29 May 2011 19:55
Co is currently offline  Co
Messages: 75
Registered: May 2011
Karma: 0
Member
Hi All,

I am trying to create a page that will display the map with a location
which was pulled from a database.
I have all the objects on the page but nothing happens.

include_once("scripts/checkuserlog.php");
$id = "";
$name = "";
$address = "";
$lat = "";
$lon = "";
$type = "";

if (isset($_POST['country'])){
$name = $_POST['country'];
print $_POST['country'];
$sql = mysql_query("SELECT * FROM markers WHERE name='$name' LIMIT
1"); // query the country map
$existCount = mysql_num_rows($sql); // count the row nums
if ($existCount == 0) { // evaluate the count
header("location: index.php?msg=user_does_not_exist");
exit();
}
while($row = mysql_fetch_array($sql)){
$name = $row["name"];
$address = $row["address"];
$lat = $row["lat"];
$lon = $row["lon"];
$type = $row["type"];
}
}

?>


<script src="http://maps.google.com.eg/maps?
file=api&v=1&key=ABQIAAAAcbSvrs7S6hX-BTk3JGmQGRTCOtZiutHD0EH7FW-
XlyavaH7Y8BQIB4o48VeLH0LszB31Sf7MqZfTIA" type="text/javascript"></
script>
<script language="javascript" type="text/javascript">
function GetEmbassyMap(x,y) {
var map = new GMap(document.getElementById("map"));
var point = new GPoint(x,y); // first lon and then lat
map.centerAndZoom(point, 3);
var marker = new GMarker(point);
map.addOverlay(marker);
}
</script>

<select name="country" class="formFields">
<option value="Afghanistan">Afghanistan</option>
<option value="Albania">Albania</option>
<option value="Algeria">Algeria</option>
<option value="American Samoa">American Samoa</
option>
<option value="Andorra">Andorra</option>
<option value="Angola">Angola</option>
<option value="Anguilla">Anguilla</option>
<option value="Antigua and Barbuda">Antigua and
Barbuda</option>
<option value="Argentina">Argentina</option>
<option value="Armenia">Armenia</option>
<option value="Aruba">Aruba</option>
<option value="Australia">Australia</option>
<option value="Austria">Austria</option>
<option value="Azerbaijan">Azerbaijan</option>
<option value="Bahamas">Bahamas</
option> ........etc etc

</select>
<input name="submit" type="submit" id="submit"
value="Search" />
</td>
</tr>
<tr><div id="map" style="width: 400px; height: 300px">
<a href="#" onclick="return false"
onmousedown="javascript:GetEmbassyMap($lat,$lon);"></a>
</div></p>
</tr>

What am I doing wrong here?

Marco
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Undefined variable: Origin
Next Topic: How to run php file in browser using windows Scheduled Task
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Dec 11 21:07:32 GMT 2024

Total time taken to generate the page: 0.03815 seconds