<s>
A	O
webform	B-General_Concept
,	O
web	B-General_Concept
form	I-General_Concept
or	O
HTML	B-General_Concept
form	I-General_Concept
on	O
a	O
web	O
page	O
allows	O
a	O
user	O
to	O
enter	O
data	O
that	O
is	O
sent	O
to	O
a	O
server	B-Application
for	O
processing	O
.	O
</s>
<s>
For	O
example	O
,	O
forms	O
can	O
be	O
used	O
to	O
enter	O
shipping	O
or	O
credit	O
card	O
data	O
to	O
order	O
a	O
product	O
,	O
or	O
can	O
be	O
used	O
to	O
retrieve	O
search	B-Application
results	I-Application
from	O
a	O
search	B-Application
engine	I-Application
.	O
</s>
<s>
Forms	O
are	O
enclosed	O
in	O
the	O
HTML	B-Language
<form>	O
element	O
.	O
</s>
<s>
This	O
HTML	B-General_Concept
element	I-General_Concept
specifies	O
the	O
communication	B-Protocol
endpoint	I-Protocol
the	O
data	O
entered	O
into	O
the	O
form	O
should	O
be	O
submitted	O
to	O
,	O
and	O
the	O
method	O
of	O
submitting	O
the	O
data	O
,	O
GET	O
or	O
POST	B-Protocol
.	O
</s>
<s>
Forms	O
can	O
be	O
made	O
up	O
of	O
standard	O
graphical	B-Application
user	I-Application
interface	I-Application
elements	O
:	O
</s>
<s>
<reset>	O
—	O
a	O
reset	B-Application
button	I-Application
that	O
,	O
when	O
activated	O
,	O
tells	O
the	O
browser	B-Application
to	O
restore	O
the	O
values	O
of	O
the	O
current	O
form	O
,	O
to	O
their	O
initial	O
values	O
.	O
</s>
<s>
These	O
basic	O
elements	O
provide	O
most	O
common	O
graphical	B-Application
user	I-Application
interface	I-Application
(	O
GUI	B-Application
)	O
elements	O
,	O
but	O
not	O
all	O
.	O
</s>
<s>
A	O
grid	O
view	O
,	O
however	O
,	O
can	O
be	O
mimicked	O
by	O
using	O
a	O
standard	O
HTML	B-General_Concept
table	I-General_Concept
with	O
each	O
cell	O
containing	O
a	O
text	O
input	O
element	O
.	O
</s>
<s>
In	O
both	O
cases	O
,	O
a	O
server-side	O
process	O
is	O
responsible	O
for	O
processing	O
the	O
information	O
,	O
while	O
JavaScript	B-Language
handles	O
the	O
user-interaction	O
.	O
</s>
<s>
Implementations	O
of	O
these	O
interface	O
elements	O
are	O
available	O
through	O
JavaScript	B-Language
libraries	I-Language
such	O
as	O
jQuery	B-Language
.	O
</s>
<s>
HTML	B-Language
4	O
introduced	O
the	O
<label>	O
tag	B-General_Concept
,	O
which	O
is	O
intended	O
to	O
represent	O
a	O
caption	O
in	O
a	O
user	O
interface	O
,	O
and	O
can	O
be	O
associated	O
with	O
a	O
specific	O
form	O
control	O
by	O
specifying	O
the	O
id	O
attribute	B-General_Concept
of	O
the	O
control	O
in	O
the	O
label	O
tag	B-General_Concept
's	O
for	O
attribute	B-General_Concept
.	O
</s>
<s>
HTML	B-Application
5	I-Application
introduces	O
a	O
number	O
of	O
input	O
tags	B-General_Concept
that	O
can	O
be	O
represented	O
by	O
other	O
interface	O
elements	O
.	O
</s>
<s>
There	O
are	O
additional	O
attributes	O
to	O
specify	O
required	O
fields	O
,	O
fields	O
that	O
should	O
have	O
keyboard	O
focus	B-Application
when	O
the	O
web	O
page	O
containing	O
the	O
form	O
is	O
loaded	O
,	O
and	O
placeholder	O
text	O
that	O
is	O
displayed	O
within	O
the	O
field	O
but	O
is	O
not	O
user	O
input	O
(	O
such	O
as	O
the	O
'	O
Search	O
 '	O
text	O
displayed	O
in	O
many	O
search	O
input	O
fields	O
before	O
a	O
search	O
term	O
is	O
entered	O
)	O
.	O
</s>
<s>
These	O
tasks	O
used	O
to	O
be	O
handled	O
with	O
JavaScript	B-Language
,	O
but	O
had	O
become	O
so	O
common	O
that	O
support	O
for	O
them	O
was	O
added	O
to	O
the	O
standard	O
.	O
</s>
<s>
And	O
the	O
color	O
input	O
type	O
can	O
be	O
represented	O
as	O
an	O
input	O
text	O
simply	O
checking	O
the	O
value	O
entered	O
is	O
a	O
correct	O
hexadecimal	O
representation	O
of	O
a	O
color	O
,	O
according	O
to	O
the	O
specification	O
,	O
or	O
a	O
color	O
picker	O
widget	O
(	O
the	O
latter	O
being	O
the	O
solution	O
used	O
in	O
most	O
browsers	B-Application
which	O
support	O
this	O
attribute	B-General_Concept
)	O
.	O
</s>
<s>
When	O
data	O
that	O
has	O
been	O
entered	O
into	O
HTML	B-General_Concept
forms	I-General_Concept
is	O
submitted	O
,	O
the	O
names	O
and	O
values	O
in	O
the	O
form	O
elements	O
are	O
encoded	O
and	O
sent	O
to	O
the	O
server	B-Application
in	O
an	O
HTTP	B-Protocol
request	O
message	O
using	O
GET	O
or	O
POST	B-Protocol
.	O
</s>
<s>
The	O
default	O
MIME	B-Application
type	I-Application
(	O
internet	B-Application
media	I-Application
type	I-Application
)	O
,	O
application/x	O
-www-form-urlencoded	O
,	O
is	O
based	O
on	O
a	O
very	O
early	O
version	O
of	O
the	O
general	O
URI	O
percent-encoding	O
rules	O
,	O
with	O
a	O
number	O
of	O
modifications	O
such	O
as	O
newline	O
normalization	O
and	O
replacing	O
spaces	O
with	O
"	O
+	O
"	O
instead	O
of	O
"	O
%20	O
"	O
.	O
</s>
<s>
Another	O
possible	O
encoding	O
,	O
Internet	B-Application
media	I-Application
type	I-Application
multipart/form	O
-data	O
,	O
is	O
also	O
available	O
and	O
is	O
common	O
for	O
POST-based	O
file	O
submissions	O
.	O
</s>
<s>
Forms	O
are	O
usually	O
combined	O
with	O
programs	O
written	O
in	O
various	O
programming	O
language	O
to	O
allow	O
developers	B-Application
to	O
create	O
dynamic	O
web	O
sites	O
.	O
</s>
<s>
The	O
most	O
popular	O
languages	O
include	O
both	O
client-side	O
and/or	O
server-side	O
languages	O
.	O
</s>
<s>
Although	O
any	O
programming	O
language	O
can	O
be	O
used	O
on	O
the	O
server	B-Application
to	O
process	O
a	O
form	O
's	O
data	O
,	O
the	O
most	O
commonly	O
used	O
languages	O
are	O
scripting	B-Language
languages	I-Language
,	O
which	O
tend	O
to	O
have	O
stronger	O
string	O
handling	O
functionality	O
than	O
programming	O
languages	O
such	O
as	O
C	O
,	O
and	O
also	O
have	O
automatic	O
memory	O
management	O
which	O
helps	O
to	O
prevent	O
buffer	B-General_Concept
overrun	I-General_Concept
attacks	O
.	O
</s>
<s>
The	O
de	O
facto	O
client-side	O
scripting	B-Language
language	I-Language
for	O
web	O
sites	O
is	O
JavaScript	B-Language
.	O
</s>
<s>
Using	O
JavaScript	B-Language
on	O
the	O
Document	B-General_Concept
Object	I-General_Concept
Model	I-General_Concept
(	O
DOM	B-General_Concept
)	O
leads	O
to	O
the	O
method	O
of	O
Dynamic	B-General_Concept
HTML	I-General_Concept
that	O
allows	O
dynamic	O
creation	O
and	O
modification	O
of	O
a	O
web	O
page	O
within	O
the	O
browser	B-Application
.	O
</s>
<s>
While	O
client-side	O
languages	O
used	O
in	O
conjunction	O
with	O
forms	O
are	O
limited	O
,	O
they	O
often	O
can	O
serve	O
to	O
do	O
pre-validation	O
of	O
the	O
form	O
data	O
and/or	O
to	O
prepare	O
the	O
form	O
data	O
to	O
send	O
to	O
a	O
server-side	O
program	O
.	O
</s>
<s>
This	O
usage	O
is	O
being	O
replaced	O
,	O
however	O
,	O
by	O
HTML5	B-Application
's	O
new	O
input	O
field	O
types	O
and	O
required	O
attribute	B-General_Concept
.	O
</s>
<s>
Server-side	O
code	O
can	O
do	O
a	O
vast	O
assortment	O
of	O
tasks	O
to	O
create	O
dynamic	O
web	O
sites	O
that	O
,	O
for	O
technical	O
or	O
security	O
reasons	O
,	O
client-side	O
code	O
cannot	O
from	O
authenticating	O
a	O
login	B-General_Concept
,	O
to	O
retrieving	O
and	O
storing	O
data	O
in	O
a	O
database	O
,	O
to	O
spell	B-Application
checking	I-Application
,	O
to	O
sending	O
e-mail	O
.	O
</s>
<s>
A	O
significant	O
advantage	O
to	O
server-side	O
over	O
client-side	O
execution	O
is	O
the	O
concentration	O
of	O
functionality	O
onto	O
the	O
server	B-Application
rather	O
than	O
relying	O
on	O
different	O
web	B-Application
browsers	I-Application
to	O
implement	O
various	O
functions	O
in	O
consistent	O
,	O
standardized	O
ways	O
.	O
</s>
<s>
In	O
addition	O
,	O
processing	O
forms	O
on	O
a	O
server	B-Application
often	O
results	O
in	O
increased	O
security	O
if	O
server-side	O
execution	O
is	O
designed	O
not	O
to	O
trust	O
the	O
data	O
supplied	O
by	O
the	O
client	O
and	O
includes	O
such	O
techniques	O
as	O
HTML	B-General_Concept
sanitization	I-General_Concept
.	O
</s>
<s>
One	O
disadvantage	O
to	O
server	B-Application
side	O
code	O
is	O
scalabilityserver	O
side	O
processing	O
for	O
all	O
users	O
occurs	O
on	O
the	O
server	B-Application
,	O
while	O
client	O
side	O
processing	O
occurs	O
on	O
individual	O
client	O
computers	O
.	O
</s>
<s>
Some	O
of	O
the	O
interpreted	B-Application
languages	I-Application
commonly	O
used	O
to	O
design	O
interactive	O
forms	O
in	O
web	O
development	O
are	O
PHP	B-Application
,	O
Python	B-Language
,	O
Ruby	B-Language
,	O
Perl	B-Language
,	O
JSP	B-Language
,	O
Adobe	B-Language
ColdFusion	I-Language
and	O
some	O
of	O
the	O
compiled	O
languages	O
commonly	O
used	O
are	O
Java	B-Language
and	O
C#	B-Application
with	O
ASP.NET	B-Application
.	O
</s>
<s>
PHP	B-Application
is	O
one	O
very	O
common	O
language	O
used	O
for	O
server-side	O
"	O
programming	O
"	O
and	O
is	O
one	O
of	O
the	O
few	O
languages	O
created	O
specifically	O
for	O
web	O
programming	O
.	O
</s>
<s>
To	O
use	O
PHP	B-Application
with	O
an	O
HTML	B-General_Concept
form	I-General_Concept
,	O
the	O
URL	O
of	O
the	O
PHP	B-Application
script	I-Application
is	O
specified	O
in	O
the	O
action	O
attribute	B-General_Concept
of	O
the	O
form	O
tag	B-General_Concept
.	O
</s>
<s>
The	O
target	O
PHP	B-Application
file	O
then	O
accesses	O
the	O
data	O
passed	O
by	O
the	O
form	O
through	O
PHP	B-Application
's	O
or	O
variables	O
,	O
depending	O
on	O
the	O
value	O
of	O
the	O
method	O
attribute	B-General_Concept
used	O
in	O
the	O
form	O
.	O
</s>
<s>
Here	O
is	O
a	O
basic	O
form	O
handler	O
PHP	B-Application
script	I-Application
that	O
will	O
display	O
the	O
contents	O
of	O
the	O
input	O
field	O
on	O
the	O
page	O
:	O
</s>
<s>
The	O
sample	O
code	O
above	O
uses	O
PHP	B-Application
's	O
function	O
to	O
sanitize	O
the	O
user	O
's	O
input	O
before	O
inserting	O
it	O
onto	O
the	O
page	O
.	O
</s>
<s>
Simply	O
printing	O
(	O
echoing	O
)	O
user	O
input	O
to	O
the	O
browser	B-Application
without	O
checking	O
it	O
first	O
is	O
something	O
that	O
should	O
be	O
avoided	O
in	O
secure	O
forms	O
processors	O
:	O
if	O
a	O
user	O
entered	O
the	O
JavaScript	B-Language
code	O
into	O
the	O
field	O
,	O
the	O
browser	B-Application
would	O
execute	O
the	O
script	O
on	O
the	O
page	O
,	O
just	O
as	O
if	O
it	O
had	O
been	O
coded	O
by	O
the	O
developer	B-Application
;	O
malicious	O
code	O
could	O
be	O
executed	O
this	O
way	O
.	O
</s>
<s>
was	O
introduced	O
in	O
PHP	B-Application
5.2	O
.	O
</s>
<s>
Users	O
of	O
earlier	O
PHP	B-Application
versions	O
could	O
use	O
the	O
function	O
,	O
or	O
regular	B-Language
expressions	I-Language
to	O
sanitize	O
the	O
user	O
input	O
before	O
doing	O
anything	O
with	O
it	O
.	O
</s>
<s>
Perl	B-Language
is	O
another	O
language	O
often	O
used	O
for	O
web	O
development	O
.	O
</s>
<s>
Perl	B-Language
scripts	O
are	O
traditionally	O
used	O
as	O
Common	B-Language
Gateway	I-Language
Interface	I-Language
applications	O
(	O
CGIs	O
)	O
.	O
</s>
<s>
In	O
fact	O
,	O
Perl	B-Language
is	O
such	O
a	O
common	O
way	O
to	O
write	O
CGIs	O
that	O
the	O
two	O
are	O
often	O
confused	O
.	O
</s>
<s>
CGIs	O
may	O
be	O
written	O
in	O
other	O
languages	O
than	O
Perl	B-Language
(	O
compatibility	O
with	O
multiple	O
languages	O
is	O
a	O
design	O
goal	O
of	O
the	O
CGI	B-Language
protocol	O
)	O
and	O
there	O
are	O
other	O
ways	O
to	O
make	O
Perl	B-Language
scripts	O
interoperate	O
with	O
a	O
web	B-Application
server	I-Application
than	O
using	O
CGI	B-Language
(	O
such	O
as	O
FastCGI	O
,	O
Plack	B-Language
or	O
Apache	B-Application
's	O
mod_perl	O
)	O
.	O
</s>
<s>
Perl	B-Language
CGIs	O
were	O
once	O
a	O
very	O
common	O
way	O
to	O
write	O
web	B-Application
applications	I-Application
.	O
</s>
<s>
However	O
,	O
many	O
web	O
hosts	O
today	O
effectively	O
only	O
support	O
PHP	B-Application
,	O
and	O
developers	B-Application
of	O
web	B-Application
applications	I-Application
often	O
seek	O
compatibility	O
with	O
them	O
.	O
</s>
<s>
A	O
modern	O
Perl	B-Language
5	O
CGI	B-Language
using	O
the	O
CGI	B-Language
module	O
with	O
a	O
form	O
similar	O
to	O
the	O
one	O
above	O
might	O
look	O
like	O
:	O
</s>
<s>
Among	O
the	O
simplest	O
and	O
most	O
commonly	O
needed	O
types	O
of	O
server-side	O
script	O
is	O
that	O
which	O
simply	O
emails	O
the	O
contents	O
of	O
a	O
submitted	O
form	O
.	O
</s>
<s>
One	O
of	O
the	O
most	O
popular	O
scripts	O
of	O
this	O
type	O
was	O
made	O
by	O
Matt	B-Language
's	I-Language
Script	I-Language
Archive	I-Language
.	O
</s>
<s>
Some	O
companies	O
offer	O
forms	O
as	O
a	O
hosted	B-Architecture
service	I-Architecture
.	O
</s>
<s>
Other	O
form	O
hosting	O
services	O
offer	O
free	O
contact	O
forms	O
that	O
a	O
user	O
can	O
install	O
on	O
their	O
own	O
website	O
by	O
pasting	O
the	O
service	O
's	O
code	O
into	O
the	O
site	O
's	O
HTML	B-Language
.	O
</s>
<s>
HTML	B-General_Concept
forms	I-General_Concept
were	O
first	O
implemented	O
by	O
the	O
Viola	B-Protocol
browser	B-Application
.	O
</s>
