How to Create a Form in HTML

Forms in HTML are used to capture data from the user via text boxes and buttons. This information can then be sent to the server for later review or processing.

Things You'll Need

  • HTML or text file editor
Show More

Instructions

  1. Create a Form

    • 1

      Open the program you're using to edit your web page, open the page itself, and position the cursor wherever you want the form to display.

    • 2

      Type the following:

    • 3

      Replace "input" with an alphanumeric name that you'll use to refer to the form later.

    • 4

      Replace "myform.asp" with the name of a web file that you want to receive the results of this form.

    • 5

      Fill the form with explanatory text and any number of controls like text boxes and radio buttons to receive user input. A typical text box is created with code like this----where the "type" attribute determines that the control is a text box, and the "name" attribute is used later to refer to the control in code.

    • 6

      Create a "Submit" button that the user can use to send the form data to the web file specified above. This is done by typing the following on its own line:

    • 7

      Close the form definition by typing the following on its own line:

Tips & Warnings

  • Once you create your form, you'll still need to populate it with buttons and text boxes.

  • Input from users is always unpredictable, and you can't do much to control it using HTML alone. Ultimately, you'll benefit from learning to write code, in Javascript for example, which can error-check user input before submitting it.

Related Searches:

Comments

You May Also Like

Related Ads

Featured