When the registrant has an invitation code during registration, it is incorrect to enter the invitation code. if there is no invitation code, you do not need to enter it. how can I write this judgment? Please inform
When registering
When determining whether the registrant has an invitation code, it is incorrect to enter the invitation code. if there is no invitation code, you do not need to enter it. how can I write this? Please inform
Reply content:
When registering
When determining whether the registrant has an invitation code, it is incorrect to enter the invitation code. if there is no invitation code, you do not need to enter it. how can I write this? Please inform
If there is an invitation code, it indicates that you have a valid invitation code in the background, database, cache, or other places. The user only needs to fill in the invitation code in the form, no matter what you fill in, you get the invitation code filled in by the user, and compare it with the normal valid invitation code in your background. if the invitation code is equal, it indicates that the invitation code is valid, then, the invitation code can be killed or becomes invalid. If this parameter is left blank
According to my understanding, what effect do you want is to verify the correctness if you fill in the information. if you do not fill in the information, do not verify it?
Perform a non-empty verification on the data to the backend.
$ Code = $ _ POST ['code']; // if (! Empty ($ code) {// go to the database to query the validity of the invitation code ....}
PHP if... else syntax basics
The invitation code must be in your database. if you enter the invitation code, check whether the invitation code is available. if you do not enter the invitation code, run it directly.
I think the general logic is like this,
Data is accepted in the background. if the field of the received invitation code is null, ignore it and use the logic check without the invitation code.
If the received invitation code is not empty, an invitation code is detected.
Therefore, the prompt that needs to be given on the previous page, such as the invitation code input box. the prompt is: no invitation code can be left blank.
Hope to help you