Lecture 3
Lecture 3
Lecture outline
• Form elements
• Wrap up
Introduction
• Forms are the primary method for gathering data from site
visitors then pass data to a server.
EXAMPLE
FIRST NAME: Martin
Luther
LAST NAME :
SUBMIT
Creating a form
</form>
Form Attributes
Elements in forms
There are various form elements available like:
— Text fields
— Text_area fields
— Drop-down menus
— Radio buttons
— Checkboxes
FORMS ELEMENT- THE
INPUT
• Is the most important form element
• Used to select user information.
• Is displayed in several ways, depending on the type attribute
Example
Type Description
<input type="text"> Defines a single-line text input field
<input type="radio"> Defines a radio button (for selecting
one of many choices)
<input Defines a submit button (for
type="submit"> submitting the form)
HTML Form Controls
One can use the following types of form controls 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
Text Input Controls
<form >
First name: <input type="text" name="first_name" />
<br>
Last name: <input type="text" name="last_name" />
</form>
Attributes for text
Password input controls
• 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.
<form>
<input type="radio" name="subject" value="maths"> Maths
<input type="radio" name="subject" value="physics"> Physics
</form>
Select Box Control