distance.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Distance Results</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body>
<?php
//get variables from form
$cityName = array("Indianapolis", "New York", "Tokyo", "London");
$from = $_REQUEST["from"];
$to = $_REQUEST["to"];
$distance = array(
array(0, 648, 6476, 4000),
array(648, 0, 6760, 3470),
array(6476, 6760, 0, 5956),
array(4000, 3470, 5956, 0));
$result = $distance[$from][$to];
print "<h1>Distance from $cityName[$from] to $cityName[$to] is $result miles</h1>\n";
?>
</body>
</html>