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 ., JavaScript can solve the input verification problem 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.
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.