Questions about input verification in PHP-php Tutorial

Source: Internet
Author: User
For the first time I used PHP for input verification in PHP, I used PHP as an online bookstore. during background management, the administrator entered the basic information of the book in the HTML form, how can I verify the input information. For example, the number of pages in a book must be an integer, but an error may occur when you enter text or other words. I want to use a regular expression, but I don't know how to write it. ------ Solution -------------------- js is ready ------ solution -------- about the input verification in PHP
For the first time, I used PHP as an online bookstore. during background management, the administrator entered the basic information of the book in the HTML form. how can I verify the input information. For example, the number of pages in a book must be an integer, but an error may occur when you enter text or other words. I want to use a regular expression, but I don't know how to write it.

------ Solution --------------------
Js.
------ Solution --------------------
Verify the JavaScript code once and submit the php page again.
If (isnumeric (number submitted ))
{
........
}
Else
Echo 'error occurred ';
------ Solution --------------------
Use regular expression to judge js
------ Solution --------------------
The next upstairs program.

If (is_int (submitted numeric variable )){
........
}
Else
Echo 'error occurred ';

------ Solution --------------------
I will not learn about JS.
How can I do this without learning?

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.