PHP form verification (1), php form verification

Source: Internet
Author: User
Tags php form

PHP form verification (1), php form verification

PHP Verification

Step 1: first obtain the content transmitted from the form; $ _ POST ['']; // use this function to obtain the data of the form, POST must be capitalized, and the brackets must contain single quotation marks.Step 2: Judge 1 whether the request is submitted normally: isset (); // use this function to determine whether the request is set (exists). Example: if (isset ($ _ POST ['username']) {echo submitted normally;} else {echo submitted abnormally}; // output the content in the text box named username   It is very accurate to use the isset () function to verify whether the submission is normal.   Currently, the normal submission method is submitted through a form. Currently, the unusual submission is not submitted through a form. For example, you can directly open the file after the action in the form. This is even an illegal submission. Isset () is also a security measure. The receiving page must be written   Empty () function is used to determine whether the form is filled   Htmlspecialchars () is used to format the Code, so that the Code submitted by the Code cannot be executed. Security measures. The receiving page must be written   The trim () function is used to format the code and delete spaces.   The strlen () function is used to determine the Data Length. Generally, it must be no less than a few characters.   Is_number () can be understood literally. It is a function that determines whether the data is a pure number.

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.