Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $user_postal=null;
- <form action='abc.com/list' id='locform' method='post'>
- <input type='hidden' id='latitude' name='latitude'>
- <input type='hidden' id='longitude' name='longitude'>
- </form>
- <script>
- var x = document.getElementById(\"latitude\");
- var y = document.getElementById(\"longitude\");
- var a;
- function getLocation()
- {
- if (navigator.geolocation)
- {
- navigator.geolocation.getCurrentPosition(showPosition);
- } else
- {
- x.innerHTML = \"Geolocation is not supported by this browser.\";
- }
- }
- function showPosition(position)
- {
- x.value = position.coords.latitude;
- y.value= position.coords.longitude;
- console.log(x);
- }
- function submitform()
- {
- document.forms[\"locform\"].submit();
- console.log(\"Value is sumitted\");
- }
- getLocation();
- </script>
- $users_postal=$_GET['latitude'];
- echo($users_postal);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement