Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4584556
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T21:22:17+00:00 2026-05-21T21:22:17+00:00

After a user fills his address in a text field and hits the submit

  • 0

After a user fills his address in a text field and hits the submit button the address is sent to google maps by javascript which then receives back the coordinates of the address.
I then want to pass the coordinates back to a following PHP code so I can save them to the DB.
So if this is the code under a single PHP file how can this be done?

P.S. Just to be clearer, all of this is done under one PHP function that handles the submitting.

<script type="text/javascript"
...
var lat = results[0].geometry.location.latitude;
var lng = results[0].geometry.location.longitude;
...
}
</script>
<?php
$latitude = ??? ;
$longitude = ??? ;
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T21:22:17+00:00Added an answer on May 21, 2026 at 9:22 pm

    If you get the lat/long in the page when submit is clicked – before the form is submitted to you your handling PHP script – just store the results in hidden inputs;

    <input id="lat" type="hidden" name="lat" value=""/>

    using js to update their values after you receive them from the API call;

    $("lat").value = results[0].geometry.location.latitude;
    

    Then allow the form to submit as normal and fetch “lat” from the query string/post data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want my recaptcha to appear only after user clicks submit button on the
Suppose a user inputs his/her username and password and clicks on the submit button,
The user fills in the form his email and password. After submiting the form,
After the user fills my backing bean with info through the forms, I want
I have a form that and after the user fills in this form, I
In my app after user press start button I execute some code in for
I am customizing the confirmation email sent after user registration. My problem is that
Inside my Controller i have function that runs after user clicks on item, which
I want to let the user access his/her document from the google docs in
I have to allow a user to download after he has submitted his USER

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.