What I have: The markers was created by a form submission, the form contains a postcode input. The below javascript will take this postcode and display as markers on google map. (this is a different page)
page1.php (code below)I have a php array, this array contains all infoWindow data and the javascript is to create map, markers and inforwindows.
<?php
..............
$info= array();
foreach($details as $d) {
$info[] = "<div id='infoData'>".$d['name'].$d['quantity']."<button id='details' onclick='window.location.href= \\\"page2.php\\\"'>Detail</button>"."<div>";
}
//.........
?>
The above code is everything on the infoWindow. Click that button in the products array will going to page2.php
<script>
//...................
function init() {
var mapDiv = document.getElementById("map");
var mapOptions = {
center: new google.maps.LatLng(51.528308,-0.3817765),
zoom: 12,
mapTypeId: 'roadmap'
};
var map = new google.maps.Map(mapDiv, mapOptions);
///////////////add markers//////////
var addressArray = ("abc", "def","xxx"), infoArray = (<?php echo $i; ?>);
var geocoder = new google.maps.Geocoder();
for (var i = 0, j=addressArray.length; i < j; i++) {
var info = infoArray[i];
geocoder.geocode({'address': addressArray[i]}, createCallback(info, map));
} //callback function
}
function createCallback(info, map) {
var callback = function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
var marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location,
title: 'Click for more details'
});
//..................
</script>
What I want to achieve:
page2.php
I want to show more details of that page1.php
button in infowindow
I just clicked. How should I do this? Any hint??
I wrote php code on page two, but I just getting all records out, there's no associations between that marker just clicked and the page2 record. How can I achieve this? page two do not contain any map, just purely text data.