Hey, Im trying to pass my markers array from one map o another map on the 
nextpage.

Link is http://my-walk.com/addwalk.php

Ive seen (and been told) of a few ways odf doing it, but have gone through 
with the one I found least confusing.

On the first page I have:

function saveMarkers()
    {     
      var packed = "";
      for (i = 0; (i < markersArray.length); i++) {
        if (i > 0) {
          packed += ",";
        }
        packed += escape(markersArray[i]);
      }
      document.markersArray.markersArray.value = packed;
      document.markersArray.submit();
    }

With Form:

<form name ="markersArray" action="addwalk2.php" method="post">
        <input type="hidden" name="markersArray" />
      </form>
      <a href="javascript:saveMarkers();">Proceed to Step 2</a>




On the next page:

   .....
$packed = $_POST['markersArray'];
  $markers = split(",", $packed);
  for ($i = 0; ($i < count($markers)); $i++) {    
    $markers[$i] = rawurldecode($markers[$i]);
    $markers[$i] = str_replace("\\", "\\\\", $markers[$i]);    
    $markers[$i] = str_replace("\"", "\\\"", $markers[$i]);
  }
?>
<script>
  var markersArrray = new Array (
<?php
  for ($i = 0; ($i < count($markers)); $i++) {
    if ($i > 0) {
      echo ",\n";
    }
    echo "    \"";
    echo $markers[$i];
    echo "\"";
  }
.......

I then have a function addMap() which is supposed to add these markers to 
the map on this second page:

function addMap() {

for (i in markersArray) {
          markersArray[i].setMap(map);
        }
}

But when I click on view source, there seems to be an issue with 
var markersArrray = new Array ( 
object Object
object Object
)

Anyone have any ideas what the issue is here?

Thanks for your help guys,
Rick

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to