Use the value attribute with Radio Buttons and Checkboxes

What is value attribute:-

Values are REALLY important for checkboxes and radio buttons. Web forms are all about collecting information from users and sending that information to be processed by a web server (for example, storing the user's response in a database). The value property represents the information that will be sent to the server. Without it, the checkbox or radio button won't have any information to send, and the server won't have any data to store in the database for those fields.

With text fields, the value is supplied by the user typing into the field -- but users can't type a value into a radio button or checkbox, they can only pick one. So, for example, look at this HTML.
When a form gets submitted ,the data is sent to the server and includes entries for the option selected. Input of type radio and checkboox report their values from the value attribute.

For Example:

<title> your web page title name </title>
<h1> which is best course in  wikibooster</h1>
<label for ="name">Web Designing</label>
<input type="radio" name="name" value="Web Designing">
<label for ="name">HTML</label>

<input type="radio" name="name" value="HTML">
<label for ="name">CSS</label>

<input type="checkbox" name="name" value="css">
<label for ="name">Javascript</label>

<input type="checkbox" name="name" value="javascript">
<input type="submit" value="Submit">


Please Share To Other:

Post a Comment