I wanted to check if my switch statement is true and if it is, I want to do something with it. e.g.
$a = trim($_POST['code']);
switch ($a) {
case "123";
break;
case "467";
break;
default : "incorrect";
}
I then want to do an if statement like this
if(switch == true) {
$a = trim($_POST['code']);
}
else {
$Error ="incorrect code";
$hasError = true;
}
if(switch == true) is not right. How will I check if the switch statement is true?
Thanks for your time.
$_POST['code']
is set at all? or if one of thecase 'xy':
conditions match?