我有一个页面,其中传递了3个值,页面的其余部分将基于这3个值中的任何一个进行响应。 如果1和2具有表单中的值,但3和4不要{做},则警告用户同时填写1和2
如果1和2没有值,3没有,4没有{do b}否则警告用户填写3,而忽略1,2和4的状态
如果1和2和3没有值,但是4确实{do c}则警告用户填写4,而忽略1,2和3的状态
if ($fname != '' and $lname != '') {
querytype = "name";
} else {
echo "Please enter a first and last name.";
}
if ($reg != '' and $fname == '' and $lname == '') {
$querytype = "reg";
} else {
echo "Please enter a Registration Number.";
}
if ($num != '' and $reg == '' and $fname == '' and $lname == '') {
$querytype = "number";
} else {
echo "Please enter a Phone Number.";
}
switch ($querytype) {
#name is 1 and 2.. it's a first and last name
case "name": {
break;
}
#reg is 3
case "reg":
{
break;
}
#number is 4
case "number":
{
break;
}
default: echo "Something broke.. idk";
}