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

  • SEARCH
  • Home
  • 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 8431493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:52:12+00:00 2026-06-10T05:52:12+00:00

I’ve got everything going great up to a certain point. I have a form

  • 0

I’ve got everything going great up to a certain point. I have a form where users fill out their address in form (separate fields for street, city, state, zipcode). Once they hit submit, on the submit button, I have a series of onClick functions. It consolidates their address fields into one hidden field seperated by commas and spaces (like you would handwrite your address). This works fine. Then once it’s consolidated, the next function geocodes the address and returns the latitude and longitude to hidden fields on the form as well. This works too (I think) here is the code where I do that.

function codeAddress1() {

      var sAddress = document.form.post_consolidatedAddress1.value;
      var storedLatLng;
      var lon;
      var lat;
      var splittingPoint;
      var stoppingPoint;


      geocoder.geocode( { 'address': sAddress}, function(results, status) {

          if (status == google.maps.GeocoderStatus.OK) {

                  document.form.longitude1.value = results[0].geometry.location.lng();
                  document.form.latitude1.value = results[0].geometry.location.lat();
                    alert(document.form.latitude1.value);
                    alert(document.form.longitude1.value);


          } else {

              alert("Geocode was not successful. Please contact the site webmaster and inform them of the following error: " + status);
          }
        });

  }

At least when it shows me the alerts, it has latitude and longitude in them. Here’s my problem arises though: Once I have those values in the hidden field, I need to submit it to a MySQL database to be used for sorting by distance later. I have structured the database so that the the latitude and longitude fields are type FLOAT with lengths of 10,6 (large enough to contain the returned values I’ve gotten through testing). But when I submit to the database, I never actually get the value, I only get 0.000000. I’ve tried several methods of making the value posted from the form a float, this currently what I have in my PHP where I get the values to submit:

$latitude1 = floatval($_REQUEST['latitude1']) ;
$longitude1 = floatval($_REQUEST['longitude1']) ;

I’ve also tried:

$latitude1 = (float) $_REQUEST['latitude1'] ;
$longitude1 = (float) $_REQUEST['longitude1'] ;

Nothing ever works… Can somebody please help?

  • 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-06-10T05:52:14+00:00Added an answer on June 10, 2026 at 5:52 am

    Ok, I’ve got it working. What I’ve done to get it working is: I now run the consolidation, and geocoding scripts on a separate click. I added a checkbox that asks the user to confirm that all information entered is correct, and the onclick for that checkbox runs the scripts to set the address consolidation, and set the latitude and longitude. Then they click a separate button to submit the form. Then on the php form, I don’t bother adjusting the data type, I just let it go to the database as-is and let the database handle it as a float. Then I just have the form validate that the checkbox has been selected before submitting the form. This has worked and the values show up in the database correctly. Finally.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have a text area in my form which accepts all possible characters from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
I've got a string that has curly quotes in it. I'd like to replace
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.