SQL PHP HTML ASP JavaScript articles and free scripts to download If you are facing any problem in viewing this page, please tell us
 

Checkbox tutorials


Checkbox is one of the important components of form field where user has to check by clicking the option. Checkbox values are directly taken to database or further used to process the script. Checkbox component inside a form has distinct role to play and in some cases only it is used. We can't use checkbox to ask for user to enter his / her email address. Let us try where we will use checkbox and where not to use.

Where to use Checkbox
If 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

Checkbox tutorials
Checkbox as HTML form Component basic introduction

How to retain the checkbox value once the form is posted back to original form in PHP

Updating checkbox value to a table and collecting back the value to maintain checkbox status in PHP.

Getting Check box values using array in PHP

checkbox Array of a form in ASP.

How to do a checkbox validation in client side JavaScript
Checkbox array in client side JavaScript
Check all and uncheck all a group of checkboxes using JavaScript
Limiting Maximum allowed checkbox to be checked in a form using JavaScript

Further readings
All form components validation with post back and data locking
Checkbox
How to retain form data if validation fails?
How to retain data of a text box after submitting
Retaining status of a check box
Updating checkbox value from & to a table record.
Retaining selected data of a period button of a form
Retaining selected data of a drop down list box of a form
Handling drop down list box with multiple selection options using array
Validating Date: Checking if date exist
Email address validation in a form
Email validation using Ajax & PHP
PHP Form Validation
is_numeric to check numeric numbers
ctype_alnum to check alphanumeric characters data
ctype_alpha to check alphabetic characters data
How to take care of form & query string variables if Register global is OFF?




















sadique27-12-2009
This site really helped me to understand the PHP concept.
sadique27-12-2009
This site really helped me to understand the PHP concept.
Post Comment This is for short comments only. Use the forum for more discussions.
Name
Email( not to be displayed)Privacy Policy
1+2=This is to prevent automatic submission by spammers. Please enter the result of the sum as asked

Sections
PHP
JavaScript
ASP
HTML
SQL
Photoshop
Articles SEO
PHP Tutorials
Form handling
PHP Monthly Planner
PHP Introduction
Loops & structure
Array
Date & Time
Functions
Form Handling
File Handling
Math Functions
String Functions
GD Functions
Comment Posting
Content Management
PHP & Ajax
Popular Tutorials
Drop down list
File Upload
Signup script
Member Login
Line Graph
PHP MySQL Paging
PHP Calendar
Subscribe
Submit your email address and receive article and product notifications. Your email is safe with us.