I have a form where users can ship pallets for fixed costs depending on their location. Currently this is for UK and France. For each country they are spilt up into 4 zones.
So we have a table like this:
I was thinking the best way to do this is to create a two dimensional array like this somehow:
var values = array[
[1][1] = 20,
[1][2] = 25,
[1][3] = 35,
[1][4] = 40,
[2][1] = 36,
[2][2] = 42,
[2][3] = 50,
[2][4] = 56,
[3][1] = 42,
[3][2] = 56,
[3][3] = 52,
[3][4] = 68,
[4][1] = 60,
[4][2] = 70,
[4][3] = 68,
[4][4] = 72,
]
So ideally if a user selects UK Zone 1 (Radio Button) then Selects France Zone 3 (Radio Button) the output value will be 35.
Form:
<form id="uk_zones">
<div><input type="radio" name="uk_zone1" value="1">UK zone 1</div>
<div><input type="radio" name="uk_zone2" value="2">UK zone 2</div>
<div><input type="radio" name="uk_zone3" value="3">UK zone 3</div>
<div><input type="radio" name="uk_zone4" value="4">UK zone 4</div>
</form>
<br />
<form id="fr_zones">
<div><input type="radio" name="fr_zone1" value="1">France zone 1</div>
<div><input type="radio" name="fr_zone2" value="2">France zone 2</div>
<div><input type="radio" name="fr_zone3" value="3">France zone 3</div>
<div><input type="radio" name="fr_zone4" value="4">France zone 4</div>
</form>
The problem I am having is how to output this to the user? Is using a two dimensional array correct? Or am I completely going the wrong direction?
JsFiddle :