I want to show google map of selected theatre. first user have to select city then they have to choose theatre as per selected city. i have used drop down box for both. then, after selecting theatre, when he clicks on show button i want to show google map of that theatre.

plz help me i have tried my best but i cant be able to do this. so plz help me

Member Avatar for diafol

Do you need a button click to show a map or should it be loaded automatically on dropdown selection?

How are you delivering the Google Map - is it a custom map with an url in a DB, or is it a live map based on lat/long? Provide more info.

i have save path of theatre in my database table. and like above procedure i want to show google map in new window or in popup window by clicking button

Do you mean something like this: if you visit onderwaterwereld.org and then click on the item "Duik locaties" it will open a map in a popup. The popup is just a separate html page with all the map specifics. Copy what you need.

sory for late reply. and thanks for sugession. i have refer that link. i want to do something like that. but i want to disply theatre location as per user's choice.

The solutions I can think of is creating a page scpecifically for a specific map, with a map generated by passing the city and theater in the URL, or through Ajax

SOLUTION 1
Client Selection & Server-side map info display using GET (what ever this is :D)
- with this one, you have to prepare the map info, based from the passed GET data on another script.

  1. User selects a city.
  2. User selects a theater
  3. On show button clicked, get the selected city and theater, and open a popup window with the URL(my.website.com/map.php?city=selectedCity&theater=selectedTheater)

SOLUTION 2
Client-side with ajax

  1. User selects a city
  2. User selects a theater
  3. On show button clicked, get the lat and long of the theater on the selected city through ajax call, and open a modal window view of the map,
  • If you're using static image maps, change the query string for the lat and long of the center of the map. (Static Image map)
  • If you're using its Javascript API v3, set the center of the map, Map Class Doc and if you have an overlayed marker, change its position too Marker Class Doc

Let me know if I missed something out.

I have find this from net. this is work fine. but i want to just change this with as:
i want to give chance user to select the theatre from drop down list. then click on button and it have to show google map of that theatre. i have also write drop down box code here. plz refer this and guide me.

<?php
require_once("template.php");
function main() {
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>GSmapSearchControl Sample</title>
<!– Note:
Make sure to replace the &key=internal with &key=~the value of your key~
in both the maps API script load and in the Ajax Search API script load statements
–>
<!– maps api, ajax search api, map search control code –>
<script    src="http://maps.google.com/maps?file=api&v=2&
key=ABQIAAAAGvs30FUboNhX-BMsz1wHmhRueXhM_ZR0uaVb2boWRzq1eE2kghQvVdJiR71BuD29Jsee_kDbmydTOQ"
type="text/javascript">
</script>
<script   src="http://www.google.com/uds/api?file=uds.js&    v=1.0&key=ABQIAAAAGvs30FUboNhX-BMsz1wHmhRueXhM_ZR0uaVb2boWRzq1eE2kghQvVdJiR71BuD29Jsee_kDbmydTOQ"
type="text/javascript">
</script>
<script src="http://www.google.com/uds/solutions/mapsearch/gsmapsearch.js"
type="text/javascript">
</script>
<!– ajax search stylesheet, map search stylesheet –>
<link href="http://www.google.com/uds/css/gsearch.css" rel="stylesheet"    type="text/css"/>
<link href="http://www.google.com/uds/solutions/mapsearch/gsmapsearch.css" rel="stylesheet"/>
<style>
/*body, table, p{
background-color: white;
font-family: Arial, sans-serif;
font-size: 13px;
}*/
/*#mapsearch {
width : 400px;
margin-left: 10px;
padding: 4px;
border : 1px solid #f9f9f9;
}*/
</style>
<script>
function LoadMapSearch() {
var options = {
title : "Googleplex",
url : "http://www.google.com/corporate/index.html"
}
new GSmapSearchControl(
document.getElementById("mapsearch"),
"1600 Amphitheatre Parkway, Mountain View, CA",
options
);
}
GSearch.setOnLoadCallback(LoadMapSearch);
</script>
</head>
<body>
<div id="mapsearch">Loading…</div>
<?php $result = mysql_query("select * from theatre order by theatre_name"); ?>
<select name="mapsearch" id="mapsearch" style="width: 155px;">
    <option value="">--select--</option>
    <?php
    if (mysql_num_rows($result) > 0) {
        while ($theatre = mysql_fetch_assoc($result)) {
            echo '<option value="' . $theatre['theatre_name'] . '">' . $theatre['theatre_name'] . '</option>';
        }
    }
    ?>
</select>

</body>
</html>
<?php
    }
    ?>      
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.