0
當用戶選擇等於銷售量的單選按鈕時,它將信息發送到銷售部門,工作正常。需要一些幫助。用php if else語句
我需要當用戶選擇支持部門必須輸入他們需要支持的設備的5位序列號。序列號只能在3到5個數字之間。如果串行不是3到5數字示例:
在此框中如果數字是123提交,如果12324提交,如果x3423死亡,如果12死亡,如果123456死亡。我也需要接受數字。
我能做到這一點
if($selected == 'sales') {
$body = "From: $name_field\n E-Mail: $email_field\n Address: $address\n City: $city\n State: $state\n PostalCode: $zip\n Department $selected\n How did you about us: $hear\n Country: $country\n Comments: $comment";
mail($to, $subject, $body);
header("Location: http://url/");
}
else if($selected == 'support') {
if(preg_match("/^\d{3}$|^\d{5}$/", $_POST['serial']) === 0) {
$body = "From: $name_field\n E-Mail: $email_field\n Address: $address\n City: $city\n State: $state\n PostalCode: $zip\n Department $selected\n How did you about us: $hear\n Country: $country\n Serial Number: $serial\n Comments: $comment";
mail($toa, $subject2, $body);
header("Location: http://url/");
}
else {
die('<script type="text/javascript"> alert("Serial Number is invalid");</script>');
}
}
}