Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
03-08-2014, 10:27 AM #1
- Join Date
- Aug 2013
- Thanked 0 Times in 0 Posts
I created a form that the user selects 2 addresses on. When the user submits the form it goes to another .php page to be processed and added to the mysql database.
On the process page I've added the google distance matrix api. So now when the process page loads it tells me how many kilometers are between the two postal codes, perfect.
However now I want to insert that distance into a mysql database without any more user intervention.
I then tried converting that to a php variable but again no luck.
var distanceInput = document.getElementById("distance"); distanceInput.value = response.routes.legs.distance.value / 1000;
This is the textbox
<label for="distance">Distance (km): </label>
<input type="text" name="distance" id="distance" readonly />
Then I added this code to auto fill the textbox when the page loads.
I would like to use a regular sql insert like the following.
INSERT INTO shipments (Distance) VALUES ('distanceInput') WHERE "I'll figure it out later"
03-08-2014, 02:36 PM #2
- Join Date
- Jan 2011
- Thanked 748 Times in 746 Posts
Evolution - The non-random survival of random variants.
Because I love FLEXBOX and tired of waiting: http://davidwalsh.name/goodbye-vendor-prefixes