PHP jquery form with validation _php tutorial

Source: Internet
Author: User

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;)
  1. validation.php

    PHP Code
    1. function Validatename ($name) {
    2. If it ' s not valid
    3. if (strlen ($name) < 4)
    4. return false;
    5. If it ' s valid
    6. Else
    7. return true;
    8. }
    9. function Validateemail ($email) {
    10. 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);
    11. }
    12. function Validatepasswords ($pass 1, $pass 2) {
    13. If doesn ' T MATCH
    14. if (Strpos ($pass 1, ')!== false)
    15. return false;
    16. If is valid
    17. return $pass 1 = = $pass 2 && strlen ($pass 1) > 5;
    18. }
    19. function Validatemessage ($message) {
    20. If it ' s not valid
    21. if (strlen ($message) < 10)
    22. return false;
    23. If it ' s valid
    24. Else
    25. return true;
    26. }
    27. ?>

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.