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 7775209
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T17:34:19+00:00 2026-06-01T17:34:19+00:00

I have created a page that allows a user to enter a start location

  • 0

I have created a page that allows a user to enter a start location and end location and the distance is output (this using a google API). I have several instances of this so effectively once the user is completed, there will be several start locations, end locations and the distance between the locations. I now need to link each ‘journey’ to a single submit form thats linked to a database using PHP however when I put this all in a form it stops working as every time the user inputs a journey the pages refreshes on itself. The only way I can see around this is putting each row in its own form and somehow linking all the forms to one submit button? How could I get around this problem or what is the best way of connecting it to a database? Sorry if I have not explained this well enough. The code for one of my rows can be seen below.

<form>

<tr height="60">
<td>Date</td>
<td>Job</td>
<td>Start Location</td>
<td>End Location</td>
<td>Confirm Route</td>
<td>Distance</td>
</tr>


<body onload="initialize(); initialize1(); initialize2(); initialize3(); initialize4(); initialize5(); initialize6(); initialize7(); initialize8(); initialize9(); initialize10(); ">


<script type="text/javascript">
    var directionDisplay;
    var directionsService = new google.maps.DirectionsService();
    var map;

    function initialize() {
        directionsDisplay = new google.maps.DirectionsRenderer();
        var belfast = new google.maps.LatLng(55, -5)
        var myOptions = {
            zoom:5,
            mapTypeId: google.maps.MapTypeId.ROADMAP,
            center: belfast,
        }

        map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
        directionsDisplay.setMap(map);
    }

    function calcRoute() {
        var start = document.getElementById("pc1").value;
        var end = document.getElementById("pc2").value;

        var distanceInput = document.getElementById("distance");
        var request = {
            origin:start, 
            destination:end,
            travelMode: google.maps.DirectionsTravelMode.DRIVING
        };

        directionsService.route(request, function(response, status) {
            if (status == google.maps.DirectionsStatus.OK) {
                directionsDisplay.setDirections(response);
                distanceInput.value = Math.round(response.routes[0].legs[0].distance.value / 1000);
                updateTotalDistance();                  
            }
        });
    }
</script>


<tr height="38">
<td><input valign="top" type="text" name="date" id="datepicker" style="width:75px"/></td>
<td><textarea valign="top" name="job" cols="10" rows="1"></textarea></td>
<td><select id="pc1">
<option>Antrim Area Hospital</option>
<option>Causeway hospital</option>
<option>Braid Valley Hospital</option>

</select>
</td>
<td><select id="pc2">
<option>Antrim Area Hospital</option>
<option>Causeway hospital</option>
<option>Braid Valley Hospital</option>

</select></td>
<td><input type="submit" value="OK" name="submit" id="submit1" onclick="calcRoute()"></td>
<td><input type="text" class="distance" id="distance" readonly="true" onkeyup="return   autocalc(this,t2,t3)" tabindex="1" style="width:45px"></td>


</form>
  • 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-01T17:34:20+00:00Added an answer on June 1, 2026 at 5:34 pm

    The best way to solve this would be to use AJAX techniques with PHP.

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

Sidebar

Related Questions

I currently have a page that allows a user to enter different types of
I have created a registration page using CI that works fine. However, I encoded
I have created page that every new user is redirected to upon visit, it
We have created a web application, using ASP.NET, that allows users to upload documents
I have the following scenario: My page has a dropdown list that allows user
I have a page that allows the user to download a dynamically-generated file. It
I have created one aspx Page from that i need to access the property
I have created a web page (ASP.NET) that includes a stylesheet to mimic Dynamics
I have created a html page in php and upon submission i validates that
I have to create a web page that for the purposes of this question

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.