javascript - passing variable from php tag to other tag in same page -


i'm tying show points in map getting latitude, longitude database while query (select * trackemployee) it's retrieving data , show on map (y)

but when i'm trying set condition where groupemail ='$mail' , date= '$date' getting data in post it's not working

if pass value condition directly, works (y)

the problem here data above php tag next php tag contain query.

<html>  <head>  <meta http-equiv="content-type" content="text/html; charset=utf-8"/>  <title>google map api v3 markers</title>  <style type="text/css">  body { font: normal 10pt helvetica, arial; }  #map { width: 750px; height: 400px; border: 0px; padding: 0px; }  </style>  <?php   $connect_mysql= @mysql_connect($server,$username,$passwor) or die ("connection failed!"); $mysql_db=mysql_select_db("gp15",$connect_mysql) or die ("could not connect database");  $mail=$_post['sel1']; echo $mail;  // prints correctly  $date=$_post['sel2']; echo $date;  // prints correctly   //on page 2 ?>   <script src="http://maps.googleapis.com/maps/api/js?sensor=false" type="text/javascript"></script>  <script type="text/javascript">  //sample code written august li  var icon = new google.maps.markerimage("http://maps.google.com/mapfiles/ms/micons/blue.png",  new google.maps.size(32, 32), new google.maps.point(0, 0),  new google.maps.point(16, 32));  var center = null;  var map = null;  var currentpopup;  var bounds = new google.maps.latlngbounds();     function addmarker(lat, lng, info) {  var pt = new google.maps.latlng(lat, lng);  bounds.extend(pt);  var marker = new google.maps.marker({  position: pt,  icon: icon,  map: map  });  var popup = new google.maps.infowindow({  content: info,  maxwidth: 300  });  google.maps.event.addlistener(marker, "click", function() {  if (currentpopup != null) {  currentpopup.close();  currentpopup = null;  }  popup.open(map, marker);  currentpopup = popup;  });  google.maps.event.addlistener(popup, "closeclick", function() {  map.panto(center);  currentpopup = null;  });  }  function initmap() {  map = new google.maps.map(document.getelementbyid("map"), {  center: new google.maps.latlng(0, 0),  zoom: 14,  maptypeid: google.maps.maptypeid.roadmap,  maptypecontrol: false,  maptypecontroloptions: {  style: google.maps.maptypecontrolstyle.horizontal_bar  },  navigationcontrol: true,  navigationcontroloptions: {  style: google.maps.navigationcontrolstyle.small  }  });    <?php 

// $query = mysql_query("select * trackemployee"); // query works

 $query = mysql_query("select * trackemployee employeeemail='$mail'and date='$date'");    while ($row = mysql_fetch_array($query)){    $name=$row['street'];  $lat=$row['latitude'];  $lon=$row['longitude'];  $desc=$row['district'];   echo ("addmarker($lat, $lon,'<b>$name</b><br/>$desc')\n");  }   ?>  center = bounds.getcenter();  map.fitbounds(bounds);   }  </script>     </head>  <body onload="initmap()" style="margin:0px; border:0px; padding:0px;">    <div id="map"></div>  </html> 

replace query this.hope works.

$query = mysql_query("select * trackemployee employeeemail='".$mail."'and date='".$date."'"); 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -