Advertisement
Guest User

Untitled

a guest
Mar 31st, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. $user_postal=null;
  2. <form action='abc.com/list' id='locform' method='post'>
  3. <input type='hidden' id='latitude' name='latitude'>
  4. <input type='hidden' id='longitude' name='longitude'>
  5. </form>
  6. <script>
  7. var x = document.getElementById(\"latitude\");
  8. var y = document.getElementById(\"longitude\");
  9. var a;
  10. function getLocation()
  11. {
  12. if (navigator.geolocation)
  13. {
  14. navigator.geolocation.getCurrentPosition(showPosition);
  15. } else
  16. {
  17. x.innerHTML = \"Geolocation is not supported by this browser.\";
  18. }
  19. }
  20.  
  21. function showPosition(position)
  22. {
  23. x.value = position.coords.latitude;
  24. y.value= position.coords.longitude;
  25. console.log(x);
  26. }
  27. function submitform()
  28. {
  29. document.forms[\"locform\"].submit();
  30. console.log(\"Value is sumitted\");
  31. }
  32.  
  33. getLocation();
  34. </script>
  35. $users_postal=$_GET['latitude'];
  36. echo($users_postal);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement