I have this error in my PHP and I can't seem to understand why:
Notice: Undefined variable: site in C:\xampp\htdocs\ws5\process.php on line 12
I seem to get it for every variable im echoing in my switch statement
my code is:
<?php
$horfield = file_get_contents("http://www.martynhicks.uk/weather/clientraw.txt");
$thornbury = file_get_contents("http://www.thornburyweather.co.uk/weatherstation/clientraw.txt");
$gloucestershire = file_get_contents("https://www.glosweather.com/clientraw.txt");
$newquay = file_get_contents("http://www.newquayweather.com/clientraw.txt");
if (isset($_GET['site'])){
$site = $_GET['site'];
}
switch ($site) {
case 'Horfield':
echo $horfield;
break;
case 'Thornbury':
echo $thornbury;
break;
case 'Glouc':
echo $gloucestershire;
break;
case 'Newquay':
echo $newquay;
break;
}
?>
(line 12 is the first echo statement 'echo $horfield', same occurs for the other 3.]
thanks