CVS: phpweather pw_utilities.php,NONE,1.1
Brought to you by:
iridium
From: Martin G. <gim...@us...> - 2002-03-18 16:13:24
|
Update of /cvsroot/phpweather/phpweather In directory usw-pr-cvs1:/tmp/cvs-serv22915 Added Files: pw_utilities.php Log Message: I think people would appreciate these functions. --- NEW FILE --- <?php /* Miscellaneous functions that can help you build an interactive site * with PHP Weather. */ function make_countries_select($weather, $old_cc) { echo' <select name="cc"> '; $countries = $weather->db->get_countries(); while (list($cc, $country) = each($countries)) { if ($cc == $old_cc) { echo "<option value=\"$cc\" selected>$country</option>\n"; } else { echo "<option value=\"$cc\">$country</option>\n"; } } echo "</select>\n"; echo '<input type="hidden" name="old_cc" value="' . $old_cc . '">'; } function make_stations_select($weather, $cc, $old_icao) { $country = ''; $icaos = $weather->db->get_icaos($cc, $country); echo ' <select name="icao"> '; while (list($icao, $name) = each($icaos)) { if ($icao == $old_icao) { echo "<option value=\"$icao\" selected>$name</option>\n"; } else { echo "<option value=\"$icao\">$name</option>\n"; } } echo "</select>\n"; echo '<input type="hidden" name="old_icao" value="' . $old_icao . '">'; } function make_languages_select($weather, $old_language) { echo ' <select name="language"> '; $languages = $weather->get_languages('text'); while (list($lc, $language) = each($languages)) { if ($lc == $old_language) { echo "<option value=\"$lc\" selected>$language</option>\n"; } else { echo "<option value=\"$lc\">$language</option>\n"; } } echo "</select>\n"; echo '<input type="hidden" name="old_language" value="' . $old_language . '">'; } ?> |