Php verification is very simple. please give it a piece of code. I know it is very simple, but I have tried a lot of methods, either do not jump or do not move. It cannot be implemented. is implemented: Enter the zip code in the input box, and then verify that if it is 5 digits, it will jump to the next page. if it is not 5, it will stay in the original page and add "Wrong Zip Code" after the input box ". thank you. ------ solution ----------- very simple php verification.
Please refer to the code section. I know it is very simple, but I have tried many methods, either not to jump or to remain unchanged. It cannot be implemented.
Is implemented: Enter the zip code in the input box, and then verify that if it is 5 digits, it will jump to the next page. if it is not 5, it will stay in the original page and add "Wrong Zip Code" after the input box ".
Thank you.
------ Solution --------------------
Script
Function iszipcode (object)
{
Var s = document. getElementById (object. id). value;
Var pattern =/^ [0-9] {6} $ /;
If (s! = "")
{
If (! Pattern.exe c (s ))
{
Alert ('Enter the correct postal code ');
Object. value = "";
Object. focus ();
}
}
}
Script