问题
I am lettings users enter their Social Security number (SSN). My system checks for SSNs in use. If the SSN is in use it says that the SSN is in use and check info. However, they are not required to enter it. How do i write a script that will check if they entered it and then verify it and if they don't enter it and they NOne or n/a then let the form process.
Update on question:
I have a certain field value that the php checks for in the DB. If the value exists, it will not let a form process and will require the user to enter a new entry. However, I want to add an exception. I want the ability to allow "none", "n/a", and blank field for this field regardless if the value exists or not. But when i run the check script, the php obviously picks up on it. So what can i do to make sure those three particular entries are allowed.
Thanks a bunch!
回答1:
if (!empty($_POST['ssn']) && $_POST['ssn'] != "none" && $_POST['ssn'] != "n/a") {
//your code to validate the ssn as one was entered
}
来源:https://stackoverflow.com/questions/4814227/user-input-verification-upon-certain-condition