Javascript-PHP registration invitation code

Source: Internet
Author: User
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

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.