- Impact
- 13
Hi everyone! Can you tell me how to pass variables from Java Script to a PHP File?
This works with a .js file, but how can I make it work with php.
html + .js file
<body>
<h1>Example</h1>
<div id="geo" class="geolocation_data"></div>
<script type="text/JavaScript" src="geo.js"></script>
</body>
</html>
html + php file - How do I have to change the code above to make it work with
the php file below?
<?php
$geo = 'http://maps.google.com/maps/api/geocode/xml?latlng='.htmlentities(htmlspecialchars(strip_tags($_GET['latlng']))).'&sensor=true';
$xml = simplexml_load_file($geo);
...
Thanks for your help.
This works with a .js file, but how can I make it work with php.
html + .js file
<body>
<h1>Example</h1>
<div id="geo" class="geolocation_data"></div>
<script type="text/JavaScript" src="geo.js"></script>
</body>
</html>
html + php file - How do I have to change the code above to make it work with
the php file below?
<?php
$geo = 'http://maps.google.com/maps/api/geocode/xml?latlng='.htmlentities(htmlspecialchars(strip_tags($_GET['latlng']))).'&sensor=true';
$xml = simplexml_load_file($geo);
...
Thanks for your help.