Dealing with multiple-choice form fields (2)-handling single checkboxes

Source: Internet
Author: User

The content in this section is similar to the content in the previous section. It is even simpler than the content in the previous section, because there is only one checkbox.

In the same way as in the previous section, if you do not select this option, $ _ Post won't contain any information about this checkbox, even the key, so we need to create it manually.

That is, (terms is the name value of checkbox)

If (! Isset ($ _ post ['terms']) {$ _ post ['terms'] = '';}

Then add it to $ expected and $ require.

Then, add the error message. If you do not check this box, you cannot continue:

1 <input type = "checkbox" name = "Terms" id = 'term' value = 'aglock'> I have read and understood the risks and agree to register 2 3 <? PHP if (in_array ('terms', $ missing) {?> 4 <SPAN class = "Waring"> Please agree to the terms before continuing </span> 5 <? PHP }?>

 

Dealing with multiple-choice form fields (2)-handling single checkboxes

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.