Course Content
Setting Up the Development Environment
Installation of all software needed to get started with web development.
0/1
HTML Forms and Tables
Working with tables and forms.
0/3
CSS: Introduction
Learning how to style your web pages.
0/2
Introduction to Web Development

1. What Are HTML Forms?

Forms allow users to enter and submit data on websites. Some of the common uses of forms include and are not limited to;

  • Login/signup pages

  • Contact forms

  • Surveys

  • Search boxes

2. Basic Form Structure

sample code for forms

Key attributs in forms

Attribute

Purpose

action

Where to send form data (URL)

method

HTTP method (GET or POST)

name

Identifies the form

3. Form Elements(Most common)

Text Inputs

sample code:

<label>Username: 
  <input type="text" name="username" placeholder="Enter username">
</label>

Password Field

<label>Password:
  <input type="password" name="pwd">
</label>

Email Input

<input type="email" name="user_email" required>

(Automatically validates email format)

Radio Buttons

<fieldset>
  <legend>Gender</legend>
  <label><input type="radio" name="gender" value="male"> Male</label>
  <label><input type="radio" name="gender" value="female"> Female</label>
</fieldset>

Check boxes

<label>
  <input type="checkbox" name="hobbies" value="sports"> Sports
</label>

Dropdown Menu

<label>Country:
  <select name="country">
    <option value="us">USA</option>
    <option value="uk">UK</option>
  </select>
</label>

Text Area

<label>Message:
  <textarea name="msg" rows="4" cols="30"></textarea>
</label>

Submit Button

<button type="submit">Register</button>


4. Important Form Attributes

Attribute

Example

Purpose

required

<input
required>

Makes field mandatory

placeholder

placeholder="Your
name"

Gray hint text

value

value="default"

Pre-filled content

disabled

<input
disabled>

Prevents editing

 

 

 

 

Scroll to Top