PHP jquery form with validation
Email detection, password duplicate detection, can be used to send the form of various environments, such as sending feedback, registered account
Demonstrate
Xml/html Code
-
- Invalid Name: We want names with more than 3 letters!
- Invalid e-mail: Stop cowboy! Type a valid e-mail please:P
- Passwords is invalid: Passwords doesn ' t match or is invalid!
- ivalid Message: Type a message with at least with ten letters
-
- congratulations! All fields is OK;)
-
validation.php
PHP Code
- function Validatename ($name) {
- If it ' s not valid
- if (strlen ($name) < 4)
- return false;
- If it ' s valid
- Else
- return true;
- }
- function Validateemail ($email) {
- Return Ereg (^[a-za-z0-9]+[a-za-z0-9_-]+@[a-za-z0-9]+[a-za-z0-9.-]+[a-za-z0-9]+.[ a-z]{2,4}$, $email);
- }
- function Validatepasswords ($pass 1, $pass 2) {
- If doesn ' T MATCH
- if (Strpos ($pass 1, ')!== false)
- return false;
- If is valid
- return $pass 1 = = $pass 2 && strlen ($pass 1) > 5;
- }
- function Validatemessage ($message) {
- If it ' s not valid
- if (strlen ($message) < 10)
- return false;
- If it ' s valid
- Else
- return true;
- }
- ?>
http://www.bkjia.com/PHPjc/735890.html www.bkjia.com true http://www.bkjia.com/PHPjc/735890.html techarticle PHP jquery form, with verification email detection, password duplicate detection, can be used to send the form of various environments, such as sending feedback, registered account demo xml/html Code Invalid name:we want nam ...