Laimonas171
02-20-2011, 07:01 PM
Got it work. Thank you for help guys.
Hi,
so i need to create an web application with two vars,
[a:var] and [b:var]
so with these two variables i need to get small map 300x400 or sth like that, so main problem is all tutorial that i found uses x and y values on map.
main point what i need is use these to variables as strings (location names).
Example. A=Lithuania, B=Paris.
so if i put these variables i want to see map with road from A to B spots.
Any ideas how to integrate that or anyone know where to find tutorial how to do that?
Thank you for answers. bold part, i need to change to my vars..
EDIT:
---------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=set_to_true_or_false">
</script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
------------------------------------
this one works fine, but it works on cords, bold part.
EDIT: Working version.
-----------------------
<?php
echo "<form method=get>IŠ:<input type='text' name=a> I:<input type='text' name=b><input type='submit' value=Rodyti></form>";
error_reporting(5);//Neberodo klaidu
//tikrina ar igauti kelio kintamieji
if($_GET['a']<>'' and $_GET['b']<>''){
$a = $_GET['a'];
$b = $_GET['b'];
echo "<iframe width=\"765\" height=\"350\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"
src=\"http://maps.google.lt/maps?f=d&source=embed&saddr=".$a."&daddr=".$b."&hl=lt&t=h&output=embed\" style=\"color:#0000FF;text-align:left\"></iframe><br />";
}
?>
Hi,
so i need to create an web application with two vars,
[a:var] and [b:var]
so with these two variables i need to get small map 300x400 or sth like that, so main problem is all tutorial that i found uses x and y values on map.
main point what i need is use these to variables as strings (location names).
Example. A=Lithuania, B=Paris.
so if i put these variables i want to see map with road from A to B spots.
Any ideas how to integrate that or anyone know where to find tutorial how to do that?
Thank you for answers. bold part, i need to change to my vars..
EDIT:
---------------------------------------------------
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<style type="text/css">
html { height: 100% }
body { height: 100%; margin: 0px; padding: 0px }
#map_canvas { height: 100% }
</style>
<script type="text/javascript"
src="http://maps.google.com/maps/api/js?sensor=set_to_true_or_false">
</script>
<script type="text/javascript">
function initialize() {
var latlng = new google.maps.LatLng(-34.397, 150.644);
var myOptions = {
zoom: 8,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
var map = new google.maps.Map(document.getElementById("map_canvas"),
myOptions);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas" style="width:100%; height:100%"></div>
</body>
</html>
------------------------------------
this one works fine, but it works on cords, bold part.
EDIT: Working version.
-----------------------
<?php
echo "<form method=get>IŠ:<input type='text' name=a> I:<input type='text' name=b><input type='submit' value=Rodyti></form>";
error_reporting(5);//Neberodo klaidu
//tikrina ar igauti kelio kintamieji
if($_GET['a']<>'' and $_GET['b']<>''){
$a = $_GET['a'];
$b = $_GET['b'];
echo "<iframe width=\"765\" height=\"350\" frameborder=\"0\" scrolling=\"no\" marginheight=\"0\" marginwidth=\"0\"
src=\"http://maps.google.lt/maps?f=d&source=embed&saddr=".$a."&daddr=".$b."&hl=lt&t=h&output=embed\" style=\"color:#0000FF;text-align:left\"></iframe><br />";
}
?>