HTML Forms Advanced Lists, Select, Links, and Form Attributes
HTML Forms Advanced Lists, Select, Links, and Form Attributes
Lists in HTML
HTML provides two types of lists: ordered (numbered) and unordered (bulleted).
Unordered Lists
An unordered list is created with the <ul> tag, and each list item is wrapped in <li>
tags:
<ul>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ul>
Ordered Lists
An ordered list uses the <ol> tag instead of <ul> :
<ol>
<li>First step</li>
<li>Second step</li>
<li>Third step</li>
</ol>
Konstant EduTech
Introduction to Web Development
Links in HTML
Links are created using the <a> (anchor) tag. Here are various ways to use links:
Basic Link
Relative Links
For linking to pages within your own website, use relative paths:
Email Links
To create a link that opens the user's email client:
SMS Links
Similarly, you can create links to send SMS messages:
Action Attribute
The action attribute specifies the URL where the form data should be sent when
submitted:
Method Attribute
The method attribute specifies how the data should be sent. The two most common
values are:
get : Data is appended to the URL (not secure, use for non-sensitive data)
Konstant EduTech
Introduction to Web Development
post : Data is sent in the body of the HTTP request (more secure, use for
sensitive data)
button : A clickable button that doesn't submit the form (useful with JavaScript)
3. The data is sent to the URL specified in the action attribute using the method
specified in the method attribute.
4. The server processes the data and typically responds with a new page or
redirects the user.
<label for="name">Name:</label>
<input type="text" id="name" name="name" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="message">Message:</label>
<textarea id="message" name="message" required></textarea>
Remember to replace YOUR_ACCESS_KEY_HERE with the actual access key you received
from FormSubmit.co.
Konstant EduTech
Introduction to Web Development
3. Check the email address you used to sign up for FormSubmit.co. You should
receive the form submission details.
How It Works
1. When the form is submitted, the data is sent to FormSubmit.co' server.
2. FormSubmit.co processes the submission and forwards the data to your email.
This method allows you to quickly set up and test form submissions without needing
to write any server-side code.
2. Create a new HTML file or modify the existing one from our previous activity.
Name input
Email input
Message textarea
Submit button
4. Use the FormSubmit.co action URL and include your access key.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-
scale=1.0">
<title>Contact Us - Book Order</title>
</head>
<body>
<h1>Contact Us About Your Book Order</h1>
<form action="https://formsubmit.co/[email protected]" method="POST">
Konstant EduTech
Introduction to Web Development
Fill in the form with the required elements and your FormSubmit.co access key. Once
you've created the form, test it by submitting some data and checking your email for
the submission.
Wrap-up
Excellent work! You've now learned about advanced HTML form elements, different
types of links, important form attributes, and even how to handle form submissions
using a third-party service like FormSubmit.co. This knowledge will allow you to create
interactive and functional web pages that can collect and process user input.
Assignment
Create a restaurant food ordering page that submits the form and sends submissions
to your email. Your page must have these tags:
html, head, title, body, form, input (text, phone, email, radio, checkbox), select, label,
fieldset, optgroup, option, legend, button (submit, reset), textarea, h1, h3
Add as much detail as you wish into the webpage. You can submit the code in the
DMs of any of the admins.
Konstant EduTech