Change the code section that looks like:
#####################################################################
## THINGS TO CHANGE
// What website contains the data
$website = "http://www.hebrides-photos.com/weather/";
// Which Datafile to look at
$datafile = "December2007.htm";
# END OF CHANGES
######################################################################
To the code below....
#####################################################################
## THINGS TO CHANGE
// What website contains the data
$website = "http://www.hebrides-photos.com/weather/";
// Which Datafile to look at
//$datafile = "December2007.htm";
// Get $datafile from below...
$mnthname = array('January', 'February', 'March', 'April', 'May', 'June',
'July', 'August', 'September', 'October', 'November', 'December');
$datefile = "";
if ( isset($_GET['date'] ) && strlen($_GET['date'] ) == 6) {
$mon = intval( substr($_GET['date'],4,2) );
if ($mon > 0 && $mon < 13 ) {
$datafile = $mnthname[ $mon - 1 ] . substr($_GET['date'],0,4) . ".htm";
}
}
if ( strlen($datafile) == 0) {
$datafile = date("FY") . ".htm" ;
}
# END OF CHANGES
######################################################################
In the HTML portion of the page (near the top) place the form:
Select a Different Report:
<form method="get" action="avgextract.php" >
<select name="date">
<option value="200709"> September 2007 </option>
<option value="200710"> October 2007 </option>
<option value="200711"> November 2007 </option>
<option value="200712"> December 2007 </option>
</select>
<input type="submit" value="Go" />
</form>
What does it do...
o It changes the script to look for a variable sent to it via a form input.
o First it looks to see if there was any variable received and if it is exactly 6 characters long (the data string).
o If it is, it uses that to set the datafile name. It figures out the Month name to use from the month part of the date string it got.
o If not, it uses the current date and year to set the datafile to the current month/year.
o The form section allows the user to input which month/year they want to view. You would need
to include each year/month you have or change the script to look for which files are there.
Now you have a wrapper around the script. It no longer is fixed to a specific date, the user can change the report to what you allow.