thi is the code i have it is a table with ur code and extra input boxes
error is on line 26 "$countryarray[] = array($elem[0], $elem[1], $elem[2], $elem[3], $elem[4], $elem[5]); "
I think
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Route Planner</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<p>
<form name="form1" method="post" action="RoutePlanner2.php">
<table width="98%" border="0">
<tr>
<td width="13%">Town 1 </td>
<td width="20%"><input name="town1" type="text" id="town1"></td>
<td colspan="2" rowspan="6">
<?php error_reporting(E_ALL);
/ open the data file /
$fn = file("/home/staff/acad/jphb/geog/towns/townsx","r");
/ now to read the files record by record /
foreach($fn as $rec)
{
$elem = explode(" ",$rec);
/ split each record into fields (: is separator) /
$countryarray[] = array($elem[0], $elem[1], $elem[2], $elem[3], $elem[4], $elem[5]);
}
echo"<form name=\"frm\"method=\"post\"><select name=\"country\" onchange=\"document.forms['frm'].submit()\" size=\"10\">";
$check=array();
foreach($countryarray as $key => $array)
{
if(!in_array($array[1],$check))
{
$check[]=$array[1];
echo"<option value=\"$array[1]\">$array[1]</option>";
}
}
echo"</select>";
if(isset($POST['country']))
{
$countryid=$POST['country'];
echo"<select name=\"town\" size=\"10\">";
foreach($countryarray as $key => $carray)
{ echo $countryid."-".$carray[1];
if($countryid==$carray[1])
{
echo"<option value=\"$carray[0]\">$carray[0]</option>";
}
}
}
?>
</select>
</td>
</tr>
<tr>
<td>Town 2 </td>
<td><input name="town2" type="text" id="town22"></td>
</tr>
<tr>
<td>Town 3 </td>
<td><input name="town3" type="text" id="town32"></td>
</tr>
<tr>
<td>Start time </td>
<td><input name="StartTime" type="text" id="StartTime2"></td>
</tr>
<tr>
<td>Stop duration </td>
<td><input name="StopDuration" type="text" id="StopDuration2"></td>
</tr>
<tr>
<td>Speed (mph)</td>
<td><input name="Speed" type="text" id="Speed2"></td>
</tr>
<tr>
<td><input name="submit" type=submit></td>
<td> </td>
<td width="32%"> </td>
<td width="35%"> </td>
</tr>
</table>
</div>
</form>
<hr>
<pre>
Number of visitors: <!--#exec cgi = "/cgi-bin/counts/counter-ord"-->
Last Review Date: <!--#flastmod file="RoutePlanner.php" -->
</pre>
<hr>
</body>
</html>