I need to use forms on my first html page to collect data for use in running a javascript function that calculates the distance formula like so -
In any case, I'm having difficulty writing the function that can calculate this formula. All the examples I can find online either don't involve a 3rd variable (the Z's) or use latitudes and longitudes. Additionally, many of these examples do the input and calculation on 1 page, whereas I need to take the input from page 1 (the values for the variables) and use it as input for the script in page 2.
Here is what I have so far (page 1) --->
Distance Formula - Input Values for X1, Y1, Z1 and X2, Y2, Z2. <form name="distance">
X1: <input type="text" name="x1_val" size="5">
<br>
Y1: <input type="text" name="y1_val" size="5">
<br>
Z1: <input type="text" name="z1_val" size="5">
<br>
X2: <input type="text" name="x2_val" size="5">
<br>
Y2: <input type="text" name="y2_val" size="5">
<br>
Z2: <input type="text" name="z2_val" size="5">
<br>
<input type="submit" value="Submit">
</form>
Can anyone help me with the script part for the formula? As well as how to take the data from the first page using forms and use it as input for the Js script function in the second? (Perferably without JSON or JQuery if possible)