Where to use CheckboxIf we present a set of options to our visitors and ask them give select some or all options then we have to use checkbox. The user can select one or more options. This is the basic difference between checkbox and radio buttons. In radio buttons only one options can be selected from a group and in a checkbox one or more than one option can be selected. Let us try for an example.
Let us present a list of weekdays to our visitor for their choice of days they want to visit a particular training program. Here the visitor can select all days or one day or any combination of days. But if we have the restriction that the visitor can select only one day out of the seven days of the week then we will show a group of radio ( or period ) buttons where only one selection can be made.
Some time we use one checkbox only and expect the visitor to check that button before submitting the form like asking the visitors to agree to site terms and conditions.
Code for a checkbox ( checked or unchecked )<input type=checkbox name=days value='Sunday'> Sunday
<input type=checkbox name=days value='Monday'> Monday
To make Monday as checked
<input type=checkbox name=days value='Monday' checked> Monday
Subscribe to our YouTube Channel here
This article is written by plus2net.com team. https://www.plus2net.com
| ▼ Web Forms & handling data in PHP