Just wondering if it is possible to convert the following If else statement to a Switch case statement:
<?
if (($Var1 == "XXX") and ($var2 == "24") and (var3 == "36"))
{ $MyAnswer = "AAA"; }
elseif (($Var1 == "YYY") and ($var2 == "24") and (var3 == "36"))
{ $MyAnswer = "BBB"; }
elseif (($Var1 == "ZZZ") and ($var2 == "12") and (var3 == "36"))
{ $MyAnswer = "CCC"; }
else
{
// If none of the above there must be an error
print (" There has been an error (Over Looked Logic case) Please carefully check your selections and try again");
}
?>
Every example of Switch i have ever seen only handles one variable:
Many Thanks.
Regards,
Chip
<?
if (($Var1 == "XXX") and ($var2 == "24") and (var3 == "36"))
{ $MyAnswer = "AAA"; }
elseif (($Var1 == "YYY") and ($var2 == "24") and (var3 == "36"))
{ $MyAnswer = "BBB"; }
elseif (($Var1 == "ZZZ") and ($var2 == "12") and (var3 == "36"))
{ $MyAnswer = "CCC"; }
else
{
// If none of the above there must be an error
print (" There has been an error (Over Looked Logic case) Please carefully check your selections and try again");
}
?>
Every example of Switch i have ever seen only handles one variable:
Many Thanks.
Regards,
Chip