📅 Week 1 - Day 3: HTML Forms, Tables & Git Basics

Friday | Duration: 3 hours

🎯 Learning Objectives

  • Create HTML forms with various input types
  • Build structured tables for data display
  • Understand Git version control basics
  • Initialize a Git repository
  • Make commits and push to GitHub

📝 Part 1: HTML Forms

What are HTML Forms?

Forms are used to collect user input. The data is typically sent to a server for processing.

Common uses: Login pages, registration, contact forms, search boxes, surveys

Basic Form Structure

<form action="/submit" method="POST"> <!-- Form elements go here --> </form>
  • action: Where to send form data (URL/file)
  • method: How to send data (GET or POST)

Common Form Elements

1. Text Input

<label for="name">Name:</label> <input type="text" id="name" name="name" required>

2. Email Input

<label for="email">Email:</label> <input type="email" id="email" name="email" required>

3. Password Input

<label for="password">Password:</label> <input type="password" id="password" name="password" required>

4. Radio Buttons (Choose One)

<p>Gender:</p> <input type="radio" id="male" name="gender" value="male"> <label for="male">Male</label> <input type="radio" id="female" name="gender" value="female"> <label for="female">Female</label>

5. Checkboxes (Choose Multiple)

<p>Skills:</p> <input type="checkbox" id="html" name="skills" value="html"> <label for="html">HTML</label> <input type="checkbox" id="css" name="skills" value="css"> <label for="css">CSS</label>

6. Dropdown (Select)

<label for="department">Department:</label> <select id="department" name="department"> <option value="">--Select--</option> <option value="cs">Computer Science</option> <option value="it">Information Technology</option> <option value="se">Software Engineering</option> </select>

7. Textarea (Multi-line Text)

<label for="message">Message:</label> <textarea id="message" name="message" rows="5" cols="50"></textarea>

8. Submit Button

<button type="submit">Submit Form</button> <!-- OR --> <input type="submit" value="Submit">

Complete Student Registration Form

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Student Registration Form</title> </head> <body> <h1>Student Registration Form</h1> <form action="#" method="POST"> <!-- Personal Information --> <h2>Personal Information</h2> <label for="fullname">Full Name:</label><br> <input type="text" id="fullname" name="fullname" required><br><br> <label for="email">Email:</label><br> <input type="email" id="email" name="email" required><br><br> <label for="phone">Phone Number:</label><br> <input type="tel" id="phone" name="phone" required><br><br> <label for="dob">Date of Birth:</label><br> <input type="date" id="dob" name="dob"><br><br> <p>Gender:</p> <input type="radio" id="male" name="gender" value="male"> <label for="male">Male</label> <input type="radio" id="female" name="gender" value="female"> <label for="female">Female</label><br><br> <!-- Academic Information --> <h2>Academic Information</h2> <label for="matric">Matric Number:</label><br> <input type="text" id="matric" name="matric" required><br><br> <label for="department">Department:</label><br> <select id="department" name="department" required> <option value="">--Select Department--</option> <option value="cs">Computer Science</option> <option value="it">Information Technology</option> <option value="se">Software Engineering</option> </select><br><br> <label for="level">Level:</label><br> <select id="level" name="level" required> <option value="100">100</option> <option value="200">200</option> <option value="300">300</option> <option value="400">400</option> </select><br><br> <p>Skills:</p> <input type="checkbox" id="html" name="skills" value="html"> <label for="html">HTML</label><br> <input type="checkbox" id="css" name="skills" value="css"> <label for="css">CSS</label><br> <input type="checkbox" id="js" name="skills" value="js"> <label for="js">JavaScript</label><br><br> <label for="comments">Additional Comments:</label><br> <textarea id="comments" name="comments" rows="5" cols="50"></textarea><br><br> <input type="checkbox" id="agree" name="agree" required> <label for="agree">I agree to the terms and conditions</label><br><br> <button type="submit">Register</button> <button type="reset">Clear Form</button> </form> </body> </html>

📊 Part 2: HTML Tables

Table Structure

Tables display data in rows and columns.

Main elements:

  • <table> - Container for the table
  • <tr> - Table row
  • <th> - Table header (bold, centered)
  • <td> - Table data cell

Basic Table Example

<table border="1"> <tr> <th>Name</th> <th>Age</th> <th>Department</th> </tr> <tr> <td>Ahmad Tijjani</td> <td>22</td> <td>IT</td> </tr> <tr> <td>Abdullahi Haruna</td> <td>20</td> <td>CS</td> </tr> </table>

Student Records Table Example

<h2>Student Records</h2> <table border="1"> <thead> <tr> <th>S/N</th> <th>Matric Number</th> <th>Full Name</th> <th>Department</th> <th>Level</th> <th>CGPA</th> </tr> </thead> <tbody> <tr> <td>1</td> <td>BUK/CS/18/0001</td> <td>Ahmad Tijjani Garba</td> <td>Information Technology</td> <td>400</td> <td>4.50</td> </tr> <tr> <td>2</td> <td>BUK/CS/19/0050</td> <td>Abdullahi Haruna Yahaya</td> <td>Computer Science</td> <td>300</td> <td>4.20</td> </tr> <tr> <td>3</td> <td>BUK/SE/20/0100</td> <td>Muhammad Nasir Hassan</td> <td>Software Engineering</td> <td>200</td> <td>3.85</td> </tr> </tbody> </table>

🔧 Part 3: Git Version Control Basics

What is Git?

Git is a version control system that tracks changes in your code over time.

Benefits:

  • Track all changes to your files
  • Collaborate with other developers
  • Revert to previous versions if needed
  • Work on multiple features simultaneously (branches)

Git vs GitHub

Git GitHub
Version control software Web-based hosting service for Git repositories
Works locally on your computer Cloud-based platform
Free and open-source Freemium service

Essential Git Commands

1. Configure Git (First Time Only)

git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"

2. Initialize a Git Repository

git init

This creates a new Git repository in your current folder.

3. Check Status

git status

Shows which files have been modified, added, or deleted.

4. Stage Files (Add to Staging Area)

git add filename.html
git add .

The dot (.) adds all changed files.

5. Commit Changes

git commit -m "Your commit message"

Saves a snapshot of your staged changes with a descriptive message.

6. Connect to GitHub

git remote add origin https://github.com/username/repo-name.git

7. Push to GitHub

git push -u origin main

Uploads your commits to GitHub.

Git Workflow Diagram

  1. Working Directory → Make changes to files
  2. git add → Stage files
  3. git commit → Save snapshot
  4. git push → Upload to GitHub

💻 Hands-On Activity: Complete Workflow

Step 1: Create Registration Form

  1. Create registration.html using the student registration form code above
  2. Add your own personal touches
  3. Test in browser

Step 2: Create Student Table

  1. Create students-table.html
  2. Build a table with at least 5 students
  3. Include: S/N, Name, Department, Level, Email

Step 3: Create GitHub Account

  1. Go to github.com
  2. Sign up for a free account
  3. Verify your email
  4. Create a new repository named "web-dev-internship"

Step 4: Initialize Git in Your Project

Open Command Prompt or Terminal in your project folder:

cd C:\xampp\htdocs\web_basics
git init
git config --global user.name "Your Name"
git config --global user.email "your@email.com"

Step 5: Make Your First Commit

git add .
git commit -m "Initial commit: Added HTML pages"

Step 6: Push to GitHub

git remote add origin https://github.com/yourusername/web-dev-internship.git
git branch -M main
git push -u origin main

💡 Pro Tips:

  • Commit often with meaningful messages
  • Use present tense: "Add feature" not "Added feature"
  • Keep commits focused on one change
  • Always pull before you push if working in a team

✏️ Practice Exercises

Exercise 1: Contact Form

Create a contact form with:

  • Name, email, phone fields
  • Subject dropdown (Inquiry, Support, Feedback)
  • Message textarea
  • Submit button

Exercise 2: Course Schedule Table

Create a table showing your class schedule:

  • Columns: Day, Time, Course Code, Course Title, Lecturer
  • At least 5 courses
  • Use proper table structure with thead and tbody

Exercise 3: Git Practice

  1. Make a change to your index.html file
  2. Check status with git status
  3. Stage the change with git add index.html
  4. Commit with message: "Update index page"
  5. Push to GitHub

✅ Today's Deliverable

Submit:

  • registration.html (working student registration form)
  • students-table.html (table with student data)
  • Link to your GitHub repository
  • Screenshot of your repo showing commits
  • Screenshot of git log showing commit history