How to Process a Checkbox With HTML

A checkbox is an HTML input element that is used extensively on the Internet. A typical website or web application that might use a checkbox could be a question or survey in which multiple options are present. For example, the question: "What are your interests? Please tick all that apply" is a common use for the HTML checkbox. You can create forms, using HTML, in which you can process and post checkbox elements.

Things You'll Need

  • HTML File
  • Form Mailer (PHP / ASP / CGI)
Show More

Instructions

    • 1

      Click on the Windows "Start" button, click on "All Programs," click on "Accessories," then click on the "Notepad" shortcut icon. This will launch the Microsoft Windows Notepad shortcut icon.

    • 2

      Click on "File," click on "Open," change the file type from "Text Documents" to "All Files," then locate and double-click on the HTML file in which you want to process a checkbox form. The contents of the HTML file should load inside Windows Notepad.

    • 3

      Locate the position within the HTML file in which you want to create the checkbox form, then copy and paste the following HTML code:

      <form name="input" action="example_form_mailer.php" method="post">

      <input type="checkbox" name="cb1" id="cb1" />Checkbox 1<br />

      <input type="checkbox" name="cb1" id="cb2" />Checkbox 2<br />

      <input type="submit" value="Submit Checkbox" />

      Make sure that you replace "example_form_mailer.php" with the correct name of the form mailer that you're using to submit the form. Replace "Checkbox 1" and "Checkbox 2" with the appropriate labels that you want to use.

    • 4

      Press "Ctrl" and "S" on your keyboard to save the file.

Tips & Warnings

  • Ensure that you modify the form mailer file to include the checkbox values. The listings of "cb1" and "cb2," for example, might be relevant in the form mailer file.

Related Searches:

References

Comments

You May Also Like

Related Ads

Featured