Basically, the value of "locations" is passed to the PHP file from a submitted form:
...
<input type="text" name="option_num" value="">
<input type="text" name="locations" value="">
...
in the PHP file:
session_start();
// snip
if ($_POST['option_num'])
$optionnum = $_POST['option_num'];
if ($_POST['locations'])
$locations = $_POST['locations'];
..
..
$_SESSION['locations'][$optionnum] = $locations;
//error_log("\locations=".$locations,3,"debug.txt");
//error_log("\session[locations]=".$_SESSION['locations'][$optionnum],3,"debug.txt");