require "../lib/ipfaces-php-lib-1.1.php";
require "citydatabase.php";
$form = new IPFForm();
$screen = $form->addScreen("How Far Is It?");
$screen->addLabel("You can find distance between your position and selected city.");
$parser = new CityDatabase();
if (isset($_COOKIE["city"])){
$value = $_COOKIE["city"];
}
$select = new IPFSelect("citySelect", $value, "Distance to" ,"list" );
$options = array();
for($row = 0; $row < count($parser->data); $row++){
$options[] = new IPFOption($row, $parser->data[$row]["City"]);
}
$select->Icon = "../img/distcalc.png";
$select->addOptions($options);
$screen->addItem($select);
$screen->addGps("gpsElement");
$screen->addButton("backButton", "1", "Examples", "../index.php", IPFButton::BUTTON_TYPE_LINK, IPFButton::BUTTON_POSITION_BACK);
$screen->addButton("submitButton", "0", "Calculate" , "distance.php", IPFButton::BUTTON_TYPE_SUBMIT, IPFButton::BUTTON_POSITION_FORWARD);
$form->render();