[resolved] If querystring exists?
Hello all.
Code:
<?php
switch ($_GET['lang']) {
case "es":
$txtGreeting = array("buenas dias");
break;
case "fr":
$txtGreeting = array("bon jour");
break;
default:
$txtGreeting = array("good day");
}
?>
The above code works just fine when I click on a link such as:
Code:
<a href="index.php?lang=fr">French</a>
But if I click a link without the querystring (?lang=fr), I receive a nasty error message:
"Undefined index: lang"
Could anyone explain to me how to determine if a querystring exists BEFORE performing the switch statement?
Or, if possible, how I could switch to default if the querystring is absent?
Many thanks.