How to obtain the values of the single-choice button and check button in a php form (example)

Source: Internet
Author: User
Tags php form
Obtain the value of the single-choice button in the form in php code: (only one single-choice button can be selected. here there is a "checked" attribute, which is selected by default, this value is used by default every time we refresh our page .) Obtain the value of the single-choice button in the form in php code: (only one single-choice button can be selected. here there is a "checked" attribute, which is selected by default, this value is used by default every time we refresh our page .)

Example:

 

If you choose male, the value is "male". if you choose female, the value is "female ".

Obtain the value of the check box in php code: (the check box allows us to select multiple ones. they exist at the same time. to facilitate value passing, we can make the name an array .)

Format:

 

Method: On the return page, use the count () function to calculate the array size and use the for loop statement to output the value of the selected check box.

Example:

 

We must learn to use arrays to solve our problems !!!!

The above is the details about how to obtain the values of the single-choice button and check button (example) in the php form. For more information, see other related articles in the first PHP community!

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.