Basic HTML Tutorial: Radio Buttons and Check Buttons in Forms

Radio button

## Syntax format:

Commonly used attributes

  • Name: The name of the element

  • Value: The value of the element, the value The data will be sent to the server.

  • Checked: Which item is selected by default. For example: checked = “checked”

Note: Only one of a set of radio buttons can be selected, but the value of the name must be consistent. For example: name = “sex”

The radio button user cannot enter the content himself, the user can only select, so it must refer to the default value value.


Check box

## Syntax format:

Common attributes

    Name: the name of the element
  • Value: The value of the element
  • Checked: Checked by default. For example: checked = "checked"
Note: The check box is also a set of options, so the value of the name must be consistent. In PHP, use an array to get the values of multiple names with the same name.

You can select multiple check boxes at the same time, or you can select none.

Let’s enrich our first example

    用户注册 
欢迎注册php.cn
用户名:
密码:
性别:
爱好:运动 看电影 编程 宅着

Is there too much content? Let’s continue adding to the next section

Continuing Learning
||
用户注册
欢迎注册php.cn
用户名:
密码:
性别:
爱好:运动 看电影 编程 宅着
submit Reset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!