Академический Документы
Профессиональный Документы
Культура Документы
F
22/02/2010
FORM
action : specify the server script for processing the form data
“action”
action can also be mailto:email_address
mailto:email address
<form action =mailto: tckwong@hkbu.edu.hk> ….. </form>
A Simple Example (orderform.html)
http://isem03 hkbu edu hk/~isemuser20/form/orderform html
http://isem03.hkbu.edu.hk/~isemuser20/form/orderform.html
<html><head>
<title>Bob's Auto Parts</title>
</head><body>
<h1>Bob's Auto Parts</h1>
<h2>Order Form</h2>
<form action="processorder.php" method=post>
<tr>
<td>Spark Plugs</td>
<td align=center><input type="text" name="sparkqty" size=3
maxlength=3></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="Submit
Order"></td>
</tr>
</table></form></body></html>
method: specify
p y how the form data should be sent
post
get
G (Program
Get ( : orderformGET.html)
f G )
http://isem03.hkbu.edu.hk/~isemuser20/form/orderformGET.html
The system will transmits the variables to the designated php
file and separate by the ? and &
It will transmits the data immediately (maximum 2K each
ti )
time)
Appended to the end of the URL
Post
The system will encrypt the data and transmits the data to the
designated php file
It will wait for the server to read the data.
Sent as a separate packet
FORM Input Elements
<input type = “option” name = “field_name”
value = “default _value” size = “width of the input box” checked>
option
p is the type
yp of input
p field
name is the name of the field and it will be treated as
variable name in script
p
checked is used to select the default_value for
checkbox or radio
input type
text, textarea, password, checkbox, radio,
hidden reset,
hidden, reset submit,
submit image,
image button,
button file
maxlength:
g the maximum number of characters that can be entered
Password input type is the same as Text input box, but the
input will be shown as “*”.
<input type=“password” name =“…” size= … maxlength= “…”>
Textarea input type allow user to enter larger quantity of
text
Text Area Input
Check Box
Menus
Buttons
Processingg pprogram
g : Processorder.php
p p
called by orderform.html
Questions ?
HTML tutorial
http://www.w3schools.com/html/default.asp
Form tutorial
http://www.w3schools.com/html/html_forms.asp