Header Ads

How to Create Checkbox Input type in html

   How to Create Checkbox in html

How to Create Checkbox  Input type in html



What is the Checkbox Input Type in HTML

HTML Checkbox is input type That allows user to select one  or more options from the list.Checkbox is commonly use in forms when multiple selections  are allowed.

Checkbox  input type creates a  small square box that users can check ( ✓)  or  uncheck. users can select multiple checkboxes at the same time.

Syntax:-

<input type="checkbox" name="option" value="value">


How to Create Checkbox in html

 program 

<html>

 <body>
<h2>checkbox </h2>

<p> The<strong>input type="checkbox"</strong>

defines a checkbox</p>

<form action="/action_page.php">

 <input type="checkbox" name="vehicle1" value="sports car">

<P>I have sports car</p><br>

<input type="checkbox" name="vehicle2" value="luxury car">

<P>I have a Luxury car</p><br><br>
<input type="submit">
</form>

</body>

</html>

How to Create Checkbox in html
Explain Program

Step 1 ]

<!Doctype html>

  • <!doctype html>  always be the first line of any HTML document.

Step 2 ]

   <html> and </html>

   html  is the root element.

Step 3 ]

<body> and </body>

body  is  main content area.

All visible content inside to  the <body> tag
Step 4]

<form action="/action_page.php">

form submitted data sent to the server-side file action page.php

Step 5]

 <input type="checkbox" name="vehicle1"
value="sports car">

create first checkbox
name = vehicle1 is the identifier use send form data.
value = sport car the server checked

Step 6]

<P>I have sports car</p><br>


first checkbox

Step 7]

<input type="checkbox" name="vehicle2"
value="Luxury Car">

second checkbox 

name= vehicle2  value= Luxury car 
Step 8]
<input type="submit">

submit button (click submit it send data action_page.php

How to Create Checkbox in html

 output 

Checkbox Tag output

No comments

Powered by Blogger.