Пример #1
0
function printoptions($tree, $activeid)
{
    $ret = "";
    if (!empty($tree)) {
        foreach ($tree as $child) {
            $ret .= "<option value='" . $child->id . "' ";
            if ($child->id == $activeid) {
                $ret .= "selected='selected'";
            }
            $ret .= ">" . $child->title . "</option>";
            $ret .= printoptions($child->children, $activeid);
        }
    }
    return $ret;
}
Пример #2
0
 $flightdate = date("Y-m-d");
 $depcountries = executePlainSQL("select distinct A.country" . " from Flight F, Airport A" . " where F.departap = A.code" . " order by country");
 printoptions($depcountries, "depcountry");
 $descountries = executePlainSQL("select distinct A.country" . " from Flight F, Airport A" . " where F.arrivalap = A.code" . " order by country");
 printoptions($descountries, "descountry");
 if (array_key_exists('depcountry', $_COOKIE)) {
     $depcountry = $_COOKIE['depcountry'];
     echo "<script>document.getElementById('depcountry').value='{$depcountry}'</script>";
     $depcities = executePlainSQL("select distinct A.city" . " from Flight F, Airport A" . " where F.departap = A.code" . " AND A.country='{$depcountry}'" . " order by city");
     printoptions($depcities, "depcity");
 }
 if (array_key_exists('descountry', $_COOKIE)) {
     $descountry = $_COOKIE['descountry'];
     echo "<script>document.getElementById('descountry').value='{$descountry}'</script>";
     $descities = executePlainSQL("select distinct A.city" . " from Flight F, Airport A" . " where F.arrivalap = A.code AND A.country='{$descountry}'" . " order by city");
     printoptions($descities, "descity");
 }
 if (array_key_exists('depcity', $_COOKIE)) {
     $depcity = $_COOKIE['depcity'];
     echo "<script>document.getElementById('depcity').value='{$depcity}'</script>";
 }
 if (array_key_exists('descity', $_COOKIE)) {
     $descity = $_COOKIE['descity'];
     echo "<script>document.getElementById('descity').value='{$descity}'</script>";
 }
 if (array_key_exists('flightdate', $_COOKIE)) {
     $flightdate = $_COOKIE['flightdate'];
     echo "<script>document.getElementById('flightdate').value='{$flightdate}'</script>";
 }
 if (array_key_exists('numtickets', $_COOKIE)) {
     $numtickets = $_COOKIE['numtickets'];