Lec15 (HTML Forms)
Lec15 (HTML Forms)
Summary of the
previous lecture
Creating tables in HTML
Table attributes
Page lay-out using tables
Outline
HTML FORMS
HTML FORM elements
1. HTML FORMS
Forms provide a means of submitting
information from the client to the server
HTML supports tags for creating forms,
however, it does not process the
information
Use server-side script to process form
information
Server-side script runs on the Web
server and receives data from a form and
uses it to perform a set of tasks
Basharat Mahmood, Department of
Computer
Science,CIIT,Islamabad,Pakistan.
1. HTML FORMS
This figure
shows how a
Web page form
interacts with a
CGI script.
1. HTML FORMS
<form> tag is used to start a form
</form> tag is used to end a form
Between <form> and </form>, form elements
are placed
We can declare a form as:
<form attributes>
form elements and layout tags
</form>
2. Form Elements
Textbox
Password Field
Hidden Field
Checkbox
Radio Button
Text Area
Select List
Submit Button
Reset Button
Basharat Mahmood, Department of
Computer
Science,CIIT,Islamabad,Pakistan.
TYPE=TEXT >
NAME
SIZE
VALUE
MAXLENGTH
Start of the
form
label
Text box
10
value
label
Text
box
11
TYPE=PASSWORD>
NAME
SIZE
VALUE
MAXLENGTH
SIZE=30
12
Type is
password
13
14
TYPE=HIDDEN>
NAME
VALUE
<INPUT TYPE=HIDDEN NAME=NAME VALUE=ALI
>
15
Type is
hidden
Basharat Mahmood, Department of
Computer
Science,CIIT,Islamabad,Pakistan.
16
17
2.4 Checkbox
<INPUT
TYPE=CHECKBOX>
CHECKED
NAME
VALUE
<INPUT TYPE=CHECKBOX NAME=CHECK VALUE=
CHECKED>
18
label
Type
option
checked
Basharat Mahmood, Department of
Computer
Science,CIIT,Islamabad,Pakistan.
value
19
label
Options
Already
checked
20
TYPE=RADIO>
CHECKED
NAME
VALUE
<INPUT TYPE=RADIO NAME=RADIO VALUE=
CHECKED>MALE
<INPUT TYPE=RADIO NAME=RADIO VALUE=
>FEMALE
21
label
Option
type
Basharat Mahmood, Department of
Computer
Science,CIIT,Islamabad,Pakistan.
Same name
22
Already
checked
Radio Button
23
Option
<SELECT name=name size=size>
<OPTION value=lahore>LAHORE</option>
<OPTION value=karachi>KARACH</option>
<OPTION value=islamabad>ISLAMABAD</option>
</SELECT>
24
List starts
options
Select ends
25
26
27
28
Text
area
29
30
31
32
33
Submit button
Reset button
34
Reset
Submi
t
Basharat Mahmood, Department of
Computer
Science,CIIT,Islamabad,Pakistan.
35
Summary
Creating forms in HTML
Adding form elements
36
References
Chapter 5, Beginning HTML,
XHTML,CSS, and JavaScript, by
Jon Duckett, Wiley Publishing;
2009, ISBN: 978-0-470-54070-1.
37