HTML Forms

Creating Forms

Use the <form> tag to collect user input, and set the action and method attributes for processing.

Form Elements

  • <input>: Text, password, checkbox, radio, etc.
  • <textarea>: Multi-line text input
  • <button>: Submit or reset buttons

Submitting Forms

Forms can be processed client-side with JavaScript or sent to a server using the specified action URL and method (GET or POST).

<form action="/submit" method="POST">
  <label for="name">Name:</label>
  <input type="text" id="name" name="name">
  <button type="submit">Submit</button>
</form>