Home  >  Article  >  Backend Development  >  PHP specific verification form process

PHP specific verification form process

WBOY
WBOYOriginal
2016-08-04 09:19:34906browse

For example, if there is an interface, I want to verify that it cannot be empty. How do I verify the specific js and php? That is, if it does not match the moment I click submit, it cannot be submitted and the mouse is moved away. It also prompts me to verify every time I verify, but the specific process sequence. I don’t know how to proceed. Is it the definition method or what? Please give me some advice from experts
PHP specific verification form process

Reply content:

For example, if there is an interface, I want to verify that it cannot be empty. How do I verify the specific js and php? That is, if it does not match the moment I click submit, it cannot be submitted and the mouse is moved away. It also prompts me to verify every time I verify, but the specific process sequence. I don’t know how to proceed. Is it the definition method or what? Please give me some advice from experts
PHP specific verification form process

It is recommended to use angular on the js side, combined with w5c validate, it is easy to implement and saves 70% of the code compared to the above answers

Of course, the server side needs to be checked again

Do a check on the front-end js or jQuery, and write the code based on the form events. The back-end PHP performs a check on the received $_POST. Don't bother because it can be faked.

Recommended plug-in for front-end form checking: official dome

And download address: Download address

First of all, let me explain that the verification of js only improves the user experience. PHP must also go through the verification process, which is safe.
The verification process depends on your needs. For example, if you want to verify when you leave the mouse, then listen to the blur event in the input box. The event will judge whether the value meets the requirements. If it does not meet the requirements, it will return false and give a corresponding prompt. If it meets the requirements, go directly Submit to the background, PHP is verifying each value.

Code on your mobile phone, just express your ideas without typing the code.

Just make a judgment before submitting. There is no need to use any other framework. Just make a judgment when clicking the submit button.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn