Hi Guys,
[CODE]
<html>
<head>
<title>642 VGS METAR</title>
</head>
<body>
<h1>642 VGS METAR</h1>
<p><a href=”javascript:location.reload(true)”>Refresh this page</a></p>
<form id=”encode” name=”encoded” align=”center”>
<?php
$location = “EGXU”;
get_metar($location);
function get_metar($location) {
$fileName = “http://weather.noaa.gov/pub/data/observations/metar/stations/$location.TXT”;
$metar = ”;
$fileData = @file($fileName) or die(‘METAR not available’);
if ($fileData != false) {
list($i, $date) = each($fileData);
$utc = strtotime(trim($date));
$time = date(“D, F jS Y g:i A”,$utc);
while (list($i, $line) = each($fileData)) {
$metar .= ‘ ‘ . trim($line);
}
$metar = trim(str_replace(‘ ‘, ‘ ‘, $metar));
}
echo “<input name=”report” readonly=”readonly” value=”$metar” size=”105″ />”;
}
?>
<p>
<input name=”decode” value=”Decode” onClick=”metar_decode(this.form.report.value);” type=”button”>
<p>Decoded Report:</p>
<textarea name=”decreport” cols=”80″ rows=”20″></textarea>
</form>
<script type=”text/javascript” src=”decode_metar.js”></script>
</body>
</html>
The above page can be found here: [URL=”http://www.theacidfrog.com/attendance/metar.php”]http://www.theacidfrog.com/attendance/metar.php
What I want to do is have the form submit onLoad however if you use the standard window.onload thing the page just keep refreshing over and over and never actually displays the result.
Any ideas how to run the decode without having to click the btn.
Cheers, S