Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Amit Yadav  >  Google Weather  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: Example
Class: Google Weather
Retrieve weather forecast for a city from Google
Author: By
Last change:
Date: 3 years ago
Size: 659 bytes
 

Contents

Class file image Download
<link rel="stylesheet" href="style.css" type="text/css" media="screen" /> 
<?php
    
include("class.google.weather.php");
    
$selectedCity = (isset($_POST["city"]) && $_POST["city"] != "")?$_POST["city"]:"Pune";

    
$googleWeather = new googleweather($selectedCity);
?>


<form method="post" name="weather">
    <select name="city" onChange="weather.submit();">
<?php
    
foreach($googleWeather->cities as $city){
?>
        <option value="<?php echo $city;?><?php echo ($selectedCity == $city)?"selected":"";?>><?php echo $city;?></option>
<?php
    
}
?>
    </select>
</form>

<?php
    $googleWeather
->getWeatherInfo();
    
$googleWeather->display_weather();
?>