I am trying to use PHP with Google map JavaScript this is my JavaScript code I have with the PHP the file name is face.php

<?php if(isset($_GET['p'])){$p=$_GET['p'];} ?>
<!DOCTYPE html >

<head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
    <title>Property Map</title>
<link rel="stylesheet" href="../../../../css/960.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="../../../../css/template.css" type="text/css" media="screen" charset="utf-8" />
<link rel="stylesheet" href="../../../../css/colour.css" type="text/css" media="screen" charset="utf-8" />
    <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
    <script type="text/javascript">
    var marker;
    var infowindow;

    function initialize() {
      var latlng = new google.maps.LatLng(30.0599153,31.2620199,13);
      var options = {
        zoom: 13,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      }
      var map = new google.maps.Map(document.getElementById("map-canvas"), options);
      var html = "<table>" +
                 "<tr><td>Name:</td> <td><input type='text' id='name'/> </td> </tr>" +
                 "<tr><td>Address:</td> <td><input type='text' id='address'/></td> </tr>" +
                 "<tr><td>Type:</td> <td><select id='type'>" +
                 "<option value='bar' SELECTED>bar</option>" +
                 "<option value='restaurant'>restaurant</option>" +
                 "</select> </td></tr>" +
                 "<tr><td></td><td><input type='button' value='Save & Close' onclick='saveData()'/></td></tr>";
    infowindow = new google.maps.InfoWindow({
     content: html
    });

    google.maps.event.addListener(map, "click", function(event) {
    marker = new google.maps.Marker({
      position: event.latLng,
      map: map
    });
    map.setCenter(event.latLng);
    google.maps.event.addListener(marker, "click", function() {
      infowindow.open(map, marker);
    });
});
    }

    function saveData() {
      var name = escape(document.getElementById("name").value);
      var address = escape(document.getElementById("address").value);
      var type = document.getElementById("type").value;
      var latlng = marker.getPosition();

      var url = "manageMap.php?propid=<?php echo $p; ?>&name=" + name + "&address=" + address +
                "&type=" + type + "&lat=" + latlng.lat() + "&lng=" + latlng.lng();
      downloadUrl(url, function(data, responseCode) {
        if (responseCode == 200 && data.length <= 1) {
          infowindow.close();
          document.getElementById("message").innerHTML = "Location added.";
        }
      });
    }

    function downloadUrl(url, callback) {
      var request = window.ActiveXObject ?
          new ActiveXObject('Microsoft.XMLHTTP') :
          new XMLHttpRequest;

      request.onreadystatechange = function() {
        if (request.readyState == 4) {
          request.onreadystatechange = doNothing;
          callback(request.responseText, request.status);
        }
      };

      request.open('GET', url, true);
      request.send(null);
    }

    function doNothing() {}
    </script>
    </head>

    <body style="margin:0px; padding:0px;" onload="initialize()">
    <h1 id="head" class="header_height"><img src="../../../../img/logo.jpg" width="284" height="73" alt="" class="logo"/></h1>
<?php
    if(isset($_GET['cid'])){$cid=$_GET['cid'];}
    if(!isset($_GET['cid'])){$cid=9;}
?>
<ul id="navigation">
  <li class='active'><a href="../../../../index.php?cid=9"><span style="color:#FFFFFF; font-size:16px;">Finish, return to projects</span></a></li>
</ul>

<div id="welcome">
<a style="color:#FFF; font-weight:bold; font-size:14px;" href="session_manager/logout.php">Sign out</a></div>

    <div style="width:100%; height:autox; margin:0 auto;">
<h1 style="margin-right:10px;">Step Three</h1>
<p style="color:#000066; font-size:18px; font-family:Arial, Helvetica, sans-serif; margin:20px;">In this step you should add new map to your property, here is how?<br />Just search for your place on the map and then put you pin there and then write the name and address and save and colse. You are done<br>
  <span style="color:#F50307; font-weight:bold;">*Important</span><br>
    After you pin you place on the Map please don't do any thing else, just click on Finish, return to projects, to avoid any problems.
</p>
<div id="map-canvas" style="width: 100%; height: 600px"></div>
<div id="message"></div>
</div>
</body>
</html>

as you see I am trying to pass propid=<?php echo $p; ?> onto my URL

on the top of the page I have this also

<?php if(isset($_GET['p'])){$p=$_GET['p'];} ?>
<!DOCTYPE html >

to get the $p

I try to use this .htaccess which content

AddType application/x-httpd-php .js

AddHandler x-httpd-php5 .js

<FilesMatch ".(js|php)$">
SetHandler application/x-httpd-php
</FilesMatch>

but the problem is when I try to go to face.php on the server it offer to download the face.php instead of open it.

see my problem here

Now how can I solve this problem are there is any other way to this

OK very easy qustion now to answer how can I get the propid by javascript and pass it again with the java in my URL

Hay thanks for all I have solved my problem I just did what I just said useing Js instaed of using php with my code

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.