SlideShare a Scribd company logo
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
Chapter 2
Part III
HTML
Topic
Forms
*****************************************************************
I. Form: are required when you want to collect some data from the
web. For example during user registration you would like to collect
information such as name, email address, credit card, etc. and
submit it to an application such as PHP.
HTML FormControls
There are different types of form controls that you can use to collect data using
HTML form:
 Text Input Controls
 Checkboxes Controls
 Radio Box Controls
 Select Box Controls
 File Select boxes
 Hidden Controls
 Clickable Buttons
 Submit and Reset Button
a. Text Input Controls
There are three types of text input used on forms:
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
 Single-line text input controls - This control is used for items that
require only one line of user input, such as search boxes or names. They
are created using HTML <input> tag.
 Password input controls - This is also a single-line text input but it
masks the character as soon as a user enters it. They are also created
using HTMl <input> tag.
 Multi-line text input controls - This is used when the user is required to
give details that may be longer than a single sentence. Multi-line input
controls are created using HTML <textarea> tag.
 Attributes
Following is the list of attributes for <input> tag for creating password field.
Attribute Description
Type Indicates the type of input control and for password input control it will be set to password.
Name Used to give a name to the control which is sent to the server to be recognized and get the value.
Value This can be used to provide an initial value inside the control.
Size Allows to specify the width of the text-input control in terms of characters.
Maxlength Allows to specify the maximum number of characters a user can enter into the text box.
Single-line text input controls
This control is used for items that require only one line of user input, such as
search boxes or names. They are created using HTML <input> tag.
Example:
<html>
<head>
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
<title>Text Input Control</title>
</head>
<body>
<form >
First name: <input type="text" name="first_name" />
<br>
Last name: <input type="text" name="last_name" />
</form>
</body>
</html>
Password input controls
This is also a single-line text input but it masks the character as soon as a user
enters it. They are also created using HTML <input> tag but type attribute is
set to password.
Example:
<html>
<head>
<title>Password Input Control</title>
</head>
<body>
<form >
User ID : <input type="text" name="user_id" />
<br>
Password: <input type="password" name="password" />
</form>
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
</body>
</html>
Multiple-Line TextInput Controls
This is used when the user is required to give details that may be longer than a
single sentence. Multi-line input controls are created using HTML <textarea>
tag.
Example:
<html>
<head>
<title>Multiple-Line Input Control</title>
</head>
<body>
<form>
Description : <br />
<textarea rows="5" cols="50" name="description">
Enter description here...
</textarea>
</form>
</body>
</html>
Attributes
Following is the list of attributes for <textarea> tag.
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
AttributeDescription
Name Used to give a name to the control which is sent to the server to be recognized and get the value.
Rows Indicates the number of rows of text area box.
Cols Indicates the number of columns of text area box
b. Checkbox Control
Checkboxes are used when more than one option is required to be selected.
They are also created using HTML <input> tag but type attribute is set to
checkbox.
<html>
<head>
<title>Checkbox Control</title>
</head>
<body>
<form>
<input type="checkbox" name="maths" value="on"> Maths
<input type="checkbox" name="physics" value="on"> Physics
</form>
</body>
</html>
Attributes
Following is the list of attributes for <checkbox> tag.
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
Attribute Description
Type Indicates the type of input control and for checkbox input control it will be set to checkbox.
Name Used to give a name to the control which is sent to the server to be recognized and get the value.
Value The value that will be used if the checkbox is selected.
Checked Set to checked if you want to select it by default.
c. Radio Button Control
Radio buttons are used when out of many options, just one option is required
to be selected. They are also created using HTML <input> tag but type
attribute is set to radio.
Example:
<html>
<head>
<title>Radio Box Control</title>
</head>
<body>
<form>
<input type="radio" name="subject" value="maths"> Maths
<input type="radio" name="subject" value="physics"> Physics
</form>
</body>
</html>
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
Attributes
Following is the list of attributes for radio button.
Attribute Description
Type Indicates the type of input control and for checkbox input control it will be set to radio.
Name Used to give a name to the control which is sent to the server to be recognized and get the value.
Value The value that will be used if the radio box is selected.
Checked Set to checked if you want to select it by default.
d. Select Box Control
A select box, also called drop down box which provides option to list down
various options in the form of drop down list, from where a user can select one
or more options.
Example:
<html>
<head>
<title>Select Box Control</title>
</head>
<body>
<form>
<select name="dropdown">
<option value="Maths" selected>Maths</option>
<option value="Physics">Physics</option>
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
</select>
</form>
</body>
</html>
Attributes
Following is the list of important attributes of <select> tag:
Attribute Description
Name Used to give a name to the control which is sent to the server to be recognized and get the value.
Size This can be used to present a scrolling list box.
Multiple If set to "multiple" then allows a user to select multiple items from the menu.
Following is the list of important attributes of <option> tag:
Attribute Description
Value The value that will be used if an option in the select box box is selected.
Selected Specifies that this option should be the initially selected value when the page loads.
Label An alternative way of labeling options
e. File Upload Box
If you want to allow a user to upload a file to your web site, you will need to
use a file upload box, also known as a file select box. This is also created using
the <input> element but type attribute is set to file.
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
Example:
<html>
<head>
<title>File Upload Box</title>
</head>
<body>
<form>
<input type="file" name="fileupload" accept="image/*" />
</form>
</body>
</html>
Attributes
Following is the list of important attributes of file upload box:
Attribute Description
Name Used to give a name to the control which is sent to the server to be recognized and get the value.
Accept Specifies the types of files that the server accepts.
f. Button Controls
There are various ways in HTML to create clickable buttons. You can also
create a clickable button using <input> tag by setting its type attribute to
button. The type attribute can take the following values:
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
Submit: This creates a button that automatically submits a form.
Reset: This creates a button that automatically resets form controls to their
initial values.
Button: This creates a button that is used to trigger a client-side script when the
user clicks that button.
Image: This creates a clickable button but we can use an image as background
of the button.
Example:
<html>
<head>
<title>File Upload Box</title>
</head>
<body>
<form>
<input type="submit" name="submit" value="Submit" />
<input type="reset" name="reset" value="Reset" />
<input type="button" name="ok" value="OK" />
<input type="image" name="imagebutton" src="/html/images/logo.png" />
</form>
</body>
</html>
Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood
Thi-Qar University, Collage of Computer sciences and Mathematics,
g. Hidden Form Controls
Hidden form controls are used to hide data inside the page which later on can
be pushed to the server. This control hides inside the code and does not appear
on the actual page. For example, following hidden form is being used to keep
current page number. When a user will click next page then the value of
hidden control will be sent to the web server and there it will decide which
page has be displayed next based on the passed current page.
<html>
<head>
<title>File Upload Box</title>
</head>
<body>
<form>
<p>This is page 10</p>
<input type="hidden" name="pagename" value="10" />
<input type="submit" name="submit" value="Submit" />
<input type="reset" name="reset" value="Reset" />
</form>
</body>
</html>Example:

More Related Content

What's hot

Entering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML FormsEntering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML Forms
sathish sak
 
HTML5 - Forms
HTML5 - FormsHTML5 - Forms
HTML5 - Formstina1357
 
Html tables, forms and audio video
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio video
Saad Sheikh
 
20 html-forms
20 html-forms20 html-forms
20 html-formsKumar
 
html forms
html formshtml forms
html forms
ikram niaz
 
Building html forms
Building html formsBuilding html forms
Building html forms
ice es
 
Designing web pages html forms and input
Designing web pages html  forms and inputDesigning web pages html  forms and input
Designing web pages html forms and inputJesus Obenita Jr.
 
html 5 new form attribute
html 5 new form attributehtml 5 new form attribute
html 5 new form attribute
Priyanka Rasal
 
Forms Part 1
Forms Part 1Forms Part 1
Forms Part 1
kjkleindorfer
 
FDMEE script examples
FDMEE script examplesFDMEE script examples
FDMEE script examples
Amit Soni
 
Murach: How to validate data in asp.net core mvc
Murach: How to validate data in asp.net core mvcMurach: How to validate data in asp.net core mvc
Murach: How to validate data in asp.net core mvc
MahmoudOHassouna
 
Creating web form(For College Seminars)
Creating web form(For College Seminars)Creating web form(For College Seminars)
Creating web form(For College Seminars)
Naman Joshi
 

What's hot (13)

Entering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML FormsEntering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML Forms
 
HTML5 - Forms
HTML5 - FormsHTML5 - Forms
HTML5 - Forms
 
Html tables, forms and audio video
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio video
 
20 html-forms
20 html-forms20 html-forms
20 html-forms
 
html forms
html formshtml forms
html forms
 
Building html forms
Building html formsBuilding html forms
Building html forms
 
Designing web pages html forms and input
Designing web pages html  forms and inputDesigning web pages html  forms and input
Designing web pages html forms and input
 
html 5 new form attribute
html 5 new form attributehtml 5 new form attribute
html 5 new form attribute
 
Forms Part 1
Forms Part 1Forms Part 1
Forms Part 1
 
Dom
DomDom
Dom
 
FDMEE script examples
FDMEE script examplesFDMEE script examples
FDMEE script examples
 
Murach: How to validate data in asp.net core mvc
Murach: How to validate data in asp.net core mvcMurach: How to validate data in asp.net core mvc
Murach: How to validate data in asp.net core mvc
 
Creating web form(For College Seminars)
Creating web form(For College Seminars)Creating web form(For College Seminars)
Creating web form(For College Seminars)
 

Viewers also liked

Software project mangement
Software project mangementSoftware project mangement
Software project mangement
Dragos Stefan Falk
 
Oman college of management & technology
Oman college of management & technologyOman college of management & technology
Oman college of management & technologyshatha al abeer
 
Operation mangement vs project management
Operation mangement vs project managementOperation mangement vs project management
Operation mangement vs project management
Jeet Manojit
 
bank transaction system
bank transaction systembank transaction system
bank transaction system
Bhavika Pathak
 
Student management system project report c++
Student management system project report c++Student management system project report c++
Student management system project report c++
Student
 
SYNOPSIS ON BANK MANAGEMENT SYSTEM
SYNOPSIS ON BANK MANAGEMENT SYSTEMSYNOPSIS ON BANK MANAGEMENT SYSTEM
SYNOPSIS ON BANK MANAGEMENT SYSTEMNitish Xavier Tirkey
 
Student management system
Student management systemStudent management system
Student management system
Amit Gandhi
 
Collage: An Exploration
Collage: An ExplorationCollage: An Exploration
Collage: An Exploration
Frank Curkovic
 

Viewers also liked (8)

Software project mangement
Software project mangementSoftware project mangement
Software project mangement
 
Oman college of management & technology
Oman college of management & technologyOman college of management & technology
Oman college of management & technology
 
Operation mangement vs project management
Operation mangement vs project managementOperation mangement vs project management
Operation mangement vs project management
 
bank transaction system
bank transaction systembank transaction system
bank transaction system
 
Student management system project report c++
Student management system project report c++Student management system project report c++
Student management system project report c++
 
SYNOPSIS ON BANK MANAGEMENT SYSTEM
SYNOPSIS ON BANK MANAGEMENT SYSTEMSYNOPSIS ON BANK MANAGEMENT SYSTEM
SYNOPSIS ON BANK MANAGEMENT SYSTEM
 
Student management system
Student management systemStudent management system
Student management system
 
Collage: An Exploration
Collage: An ExplorationCollage: An Exploration
Collage: An Exploration
 

Similar to HTML-Forms

HTML - FORMS.pptx
HTML - FORMS.pptxHTML - FORMS.pptx
HTML - FORMS.pptx
Nyssakotian
 
Html form
Html formHtml form
Html form
Jaya Kumari
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
gunjansingh599205
 
Html Xhtml And Xml 3e Tutorial 6
Html Xhtml And Xml 3e Tutorial 6Html Xhtml And Xml 3e Tutorial 6
Html Xhtml And Xml 3e Tutorial 6larsonsb
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
Mudasir Syed
 
Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
Maitree Patel
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
Abhishek Kesharwani
 
331592291-HTML-and-Cascading style sheet
331592291-HTML-and-Cascading style sheet331592291-HTML-and-Cascading style sheet
331592291-HTML-and-Cascading style sheet
stephen972973
 
Spsl v unit - final
Spsl v unit - finalSpsl v unit - final
Spsl v unit - final
Sasidhar Kothuru
 
Html5ppt
Html5pptHtml5ppt
Html5pptrecroup
 
HTML and CSS part 2
HTML and CSS part 2HTML and CSS part 2
HTML and CSS part 2
Julie Iskander
 
HTML.pptx
HTML.pptxHTML.pptx
HTML.pptx
DipaliJagtap6
 
HTML (part ii).pptx
HTML (part ii).pptxHTML (part ii).pptx
HTML (part ii).pptx
techsupport70
 
Html forms
Html formsHtml forms
Html forms
nobel mujuji
 
Html 4
Html   4Html   4

Similar to HTML-Forms (20)

HTML - FORMS.pptx
HTML - FORMS.pptxHTML - FORMS.pptx
HTML - FORMS.pptx
 
Html form
Html formHtml form
Html form
 
Unit 2
Unit 2 Unit 2
Unit 2
 
Unit 2
Unit 2 Unit 2
Unit 2
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
 
Html Xhtml And Xml 3e Tutorial 6
Html Xhtml And Xml 3e Tutorial 6Html Xhtml And Xml 3e Tutorial 6
Html Xhtml And Xml 3e Tutorial 6
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
 
Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
331592291-HTML-and-Cascading style sheet
331592291-HTML-and-Cascading style sheet331592291-HTML-and-Cascading style sheet
331592291-HTML-and-Cascading style sheet
 
Spsl v unit - final
Spsl v unit - finalSpsl v unit - final
Spsl v unit - final
 
Tut 06 (forms)
Tut 06 (forms)Tut 06 (forms)
Tut 06 (forms)
 
Html5ppt
Html5pptHtml5ppt
Html5ppt
 
HTML and CSS part 2
HTML and CSS part 2HTML and CSS part 2
HTML and CSS part 2
 
HTML.pptx
HTML.pptxHTML.pptx
HTML.pptx
 
Chapter09
Chapter09Chapter09
Chapter09
 
HTML (part ii).pptx
HTML (part ii).pptxHTML (part ii).pptx
HTML (part ii).pptx
 
Html4
Html4Html4
Html4
 
Html forms
Html formsHtml forms
Html forms
 
Html 4
Html   4Html   4
Html 4
 

More from Ahmed Saihood

Sessions &Cookies
Sessions &CookiesSessions &Cookies
Sessions &Cookies
Ahmed Saihood
 
PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
Ahmed Saihood
 
PHP-Part3
PHP-Part3PHP-Part3
PHP-Part3
Ahmed Saihood
 
PHP-Part2
PHP-Part2PHP-Part2
PHP-Part2
Ahmed Saihood
 
HTTP & HTTPs
HTTP & HTTPsHTTP & HTTPs
HTTP & HTTPs
Ahmed Saihood
 
PHP-Part1
PHP-Part1PHP-Part1
PHP-Part1
Ahmed Saihood
 
CSS
CSSCSS
XHTML
XHTMLXHTML
HTML-Part2
HTML-Part2HTML-Part2
HTML-Part2
Ahmed Saihood
 
HTML-Part1
HTML-Part1HTML-Part1
HTML-Part1
Ahmed Saihood
 
internet basics
internet basics internet basics
internet basics
Ahmed Saihood
 

More from Ahmed Saihood (11)

Sessions &Cookies
Sessions &CookiesSessions &Cookies
Sessions &Cookies
 
PHP-Part4
PHP-Part4PHP-Part4
PHP-Part4
 
PHP-Part3
PHP-Part3PHP-Part3
PHP-Part3
 
PHP-Part2
PHP-Part2PHP-Part2
PHP-Part2
 
HTTP & HTTPs
HTTP & HTTPsHTTP & HTTPs
HTTP & HTTPs
 
PHP-Part1
PHP-Part1PHP-Part1
PHP-Part1
 
CSS
CSSCSS
CSS
 
XHTML
XHTMLXHTML
XHTML
 
HTML-Part2
HTML-Part2HTML-Part2
HTML-Part2
 
HTML-Part1
HTML-Part1HTML-Part1
HTML-Part1
 
internet basics
internet basics internet basics
internet basics
 

Recently uploaded

guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
Rogerio Filho
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
JungkooksNonexistent
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
3ipehhoa
 
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptxLiving-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
TristanJasperRamos
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Sanjeev Rampal
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
natyesu
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
JeyaPerumal1
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
laozhuseo02
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
3ipehhoa
 
Output determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CCOutput determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CC
ShahulHameed54211
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
Gal Baras
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAE
Himani415946
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
laozhuseo02
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
3ipehhoa
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
Arif0071
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
nirahealhty
 

Recently uploaded (16)

guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...guildmasters guide to ravnica Dungeons & Dragons 5...
guildmasters guide to ravnica Dungeons & Dragons 5...
 
Latest trends in computer networking.pptx
Latest trends in computer networking.pptxLatest trends in computer networking.pptx
Latest trends in computer networking.pptx
 
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
急速办(bedfordhire毕业证书)英国贝德福特大学毕业证成绩单原版一模一样
 
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptxLiving-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
Living-in-IT-era-Module-7-Imaging-and-Design-for-Social-Impact.pptx
 
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesMulti-cluster Kubernetes Networking- Patterns, Projects and Guidelines
Multi-cluster Kubernetes Networking- Patterns, Projects and Guidelines
 
BASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptxBASIC C++ lecture NOTE C++ lecture 3.pptx
BASIC C++ lecture NOTE C++ lecture 3.pptx
 
1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...1.Wireless Communication System_Wireless communication is a broad term that i...
1.Wireless Communication System_Wireless communication is a broad term that i...
 
The+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptxThe+Prospects+of+E-Commerce+in+China.pptx
The+Prospects+of+E-Commerce+in+China.pptx
 
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
1比1复刻(bath毕业证书)英国巴斯大学毕业证学位证原版一模一样
 
Output determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CCOutput determination SAP S4 HANA SAP SD CC
Output determination SAP S4 HANA SAP SD CC
 
How to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptxHow to Use Contact Form 7 Like a Pro.pptx
How to Use Contact Form 7 Like a Pro.pptx
 
ER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAEER(Entity Relationship) Diagram for online shopping - TAE
ER(Entity Relationship) Diagram for online shopping - TAE
 
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shopHistory+of+E-commerce+Development+in+China-www.cfye-commerce.shop
History+of+E-commerce+Development+in+China-www.cfye-commerce.shop
 
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
原版仿制(uob毕业证书)英国伯明翰大学毕业证本科学历证书原版一模一样
 
test test test test testtest test testtest test testtest test testtest test ...
test test  test test testtest test testtest test testtest test testtest test ...test test  test test testtest test testtest test testtest test testtest test ...
test test test test testtest test testtest test testtest test testtest test ...
 
This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!This 7-second Brain Wave Ritual Attracts Money To You.!
This 7-second Brain Wave Ritual Attracts Money To You.!
 

HTML-Forms

  • 1. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics, Chapter 2 Part III HTML Topic Forms ***************************************************************** I. Form: are required when you want to collect some data from the web. For example during user registration you would like to collect information such as name, email address, credit card, etc. and submit it to an application such as PHP. HTML FormControls There are different types of form controls that you can use to collect data using HTML form:  Text Input Controls  Checkboxes Controls  Radio Box Controls  Select Box Controls  File Select boxes  Hidden Controls  Clickable Buttons  Submit and Reset Button a. Text Input Controls There are three types of text input used on forms:
  • 2. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics,  Single-line text input controls - This control is used for items that require only one line of user input, such as search boxes or names. They are created using HTML <input> tag.  Password input controls - This is also a single-line text input but it masks the character as soon as a user enters it. They are also created using HTMl <input> tag.  Multi-line text input controls - This is used when the user is required to give details that may be longer than a single sentence. Multi-line input controls are created using HTML <textarea> tag.  Attributes Following is the list of attributes for <input> tag for creating password field. Attribute Description Type Indicates the type of input control and for password input control it will be set to password. Name Used to give a name to the control which is sent to the server to be recognized and get the value. Value This can be used to provide an initial value inside the control. Size Allows to specify the width of the text-input control in terms of characters. Maxlength Allows to specify the maximum number of characters a user can enter into the text box. Single-line text input controls This control is used for items that require only one line of user input, such as search boxes or names. They are created using HTML <input> tag. Example: <html> <head>
  • 3. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics, <title>Text Input Control</title> </head> <body> <form > First name: <input type="text" name="first_name" /> <br> Last name: <input type="text" name="last_name" /> </form> </body> </html> Password input controls This is also a single-line text input but it masks the character as soon as a user enters it. They are also created using HTML <input> tag but type attribute is set to password. Example: <html> <head> <title>Password Input Control</title> </head> <body> <form > User ID : <input type="text" name="user_id" /> <br> Password: <input type="password" name="password" /> </form>
  • 4. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics, </body> </html> Multiple-Line TextInput Controls This is used when the user is required to give details that may be longer than a single sentence. Multi-line input controls are created using HTML <textarea> tag. Example: <html> <head> <title>Multiple-Line Input Control</title> </head> <body> <form> Description : <br /> <textarea rows="5" cols="50" name="description"> Enter description here... </textarea> </form> </body> </html> Attributes Following is the list of attributes for <textarea> tag.
  • 5. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics, AttributeDescription Name Used to give a name to the control which is sent to the server to be recognized and get the value. Rows Indicates the number of rows of text area box. Cols Indicates the number of columns of text area box b. Checkbox Control Checkboxes are used when more than one option is required to be selected. They are also created using HTML <input> tag but type attribute is set to checkbox. <html> <head> <title>Checkbox Control</title> </head> <body> <form> <input type="checkbox" name="maths" value="on"> Maths <input type="checkbox" name="physics" value="on"> Physics </form> </body> </html> Attributes Following is the list of attributes for <checkbox> tag.
  • 6. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics, Attribute Description Type Indicates the type of input control and for checkbox input control it will be set to checkbox. Name Used to give a name to the control which is sent to the server to be recognized and get the value. Value The value that will be used if the checkbox is selected. Checked Set to checked if you want to select it by default. c. Radio Button Control Radio buttons are used when out of many options, just one option is required to be selected. They are also created using HTML <input> tag but type attribute is set to radio. Example: <html> <head> <title>Radio Box Control</title> </head> <body> <form> <input type="radio" name="subject" value="maths"> Maths <input type="radio" name="subject" value="physics"> Physics </form> </body> </html>
  • 7. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics, Attributes Following is the list of attributes for radio button. Attribute Description Type Indicates the type of input control and for checkbox input control it will be set to radio. Name Used to give a name to the control which is sent to the server to be recognized and get the value. Value The value that will be used if the radio box is selected. Checked Set to checked if you want to select it by default. d. Select Box Control A select box, also called drop down box which provides option to list down various options in the form of drop down list, from where a user can select one or more options. Example: <html> <head> <title>Select Box Control</title> </head> <body> <form> <select name="dropdown"> <option value="Maths" selected>Maths</option> <option value="Physics">Physics</option>
  • 8. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics, </select> </form> </body> </html> Attributes Following is the list of important attributes of <select> tag: Attribute Description Name Used to give a name to the control which is sent to the server to be recognized and get the value. Size This can be used to present a scrolling list box. Multiple If set to "multiple" then allows a user to select multiple items from the menu. Following is the list of important attributes of <option> tag: Attribute Description Value The value that will be used if an option in the select box box is selected. Selected Specifies that this option should be the initially selected value when the page loads. Label An alternative way of labeling options e. File Upload Box If you want to allow a user to upload a file to your web site, you will need to use a file upload box, also known as a file select box. This is also created using the <input> element but type attribute is set to file.
  • 9. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics, Example: <html> <head> <title>File Upload Box</title> </head> <body> <form> <input type="file" name="fileupload" accept="image/*" /> </form> </body> </html> Attributes Following is the list of important attributes of file upload box: Attribute Description Name Used to give a name to the control which is sent to the server to be recognized and get the value. Accept Specifies the types of files that the server accepts. f. Button Controls There are various ways in HTML to create clickable buttons. You can also create a clickable button using <input> tag by setting its type attribute to button. The type attribute can take the following values:
  • 10. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics, Submit: This creates a button that automatically submits a form. Reset: This creates a button that automatically resets form controls to their initial values. Button: This creates a button that is used to trigger a client-side script when the user clicks that button. Image: This creates a clickable button but we can use an image as background of the button. Example: <html> <head> <title>File Upload Box</title> </head> <body> <form> <input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /> <input type="button" name="ok" value="OK" /> <input type="image" name="imagebutton" src="/html/images/logo.png" /> </form> </body> </html>
  • 11. Subject: Web Design and Programming Lecturer: Ahmed Ali Saihood Thi-Qar University, Collage of Computer sciences and Mathematics, g. Hidden Form Controls Hidden form controls are used to hide data inside the page which later on can be pushed to the server. This control hides inside the code and does not appear on the actual page. For example, following hidden form is being used to keep current page number. When a user will click next page then the value of hidden control will be sent to the web server and there it will decide which page has be displayed next based on the passed current page. <html> <head> <title>File Upload Box</title> </head> <body> <form> <p>This is page 10</p> <input type="hidden" name="pagename" value="10" /> <input type="submit" name="submit" value="Submit" /> <input type="reset" name="reset" value="Reset" /> </form> </body> </html>Example: