return;
}
- echo "<form method=\"POST\" action=\"" . $_SCRIPT['REQUEST_URI'] . "\">\n";
+ $candidates = array();
+ foreach ($cities as $city) {
+ if (! count(get_city_areas($city->getId()))) continue;
+ $candidates[] = $city;
+ }
+ if (! count($candidates)) return;
+
+ form("noprint standout");
echo "<p>Show areas in\n";
echo "<select name=\"city_id\">\n";
- foreach ($cities as $city) {
+ foreach ($candidates as $city) {
option("city_id", sprintf("%s/%s", $city->getName(), $city->getId()), get_city_displayname($city));
}
echo "</select>\n";
echo "<input type=\"submit\" value=\"Show\">\n";
- echo "</form>\n";
+ end_form();
}
function show_new_area_form($city_id = null) {
return;
}
- echo "<form method=\"POST\" action=\"" . $_SERVER['REQUEST_URI'] . "\">\n";
+ form("noprint standout");
echo "<p>Add a new area <input name=\"area_name\">\n";
echo "in <select name=\"city_id\">\n";
}
echo "</select>\n";
echo "<input type=\"submit\" value=\"Add\">\n";
- echo "</form>\n";
+ end_form();
}
function add_area($name, $city_id) {
$area = get_area_by_name($name);
if (! $area) return;
- echo "<form method=\"POST\" action=\"" . $_SERVER['REQUEST_URI'] . "\">\n";
+ form();
echo "<p>Area: <span class=\"strong\">" . $area->getName() . "</span>";
$n = $area->getName();
$i = $area->getId();
echo "<input type=\"submit\" name=\"update_area\" value=\"Update\">\n";
}
echo "</p>\n";
- echo "</form>\n";
+ end_form();
}
/* /area/in/Cambridge/1 */