2 Fill out the form incompletely and
click Add.
adding records 55
4 Go back to the form, fi ll it out
completely, and click Add.
5 Again, the PHP page shows the results.
test the non-Ajax version
56 adding records
extra bits
add the form p. 46
??? The POST method should generally
be used when the form??™s
submission should have an e?¬? ect
on the site. For example, using
the Add an Employee form adds
another record to the database.
??? The GET method should generally
be used when requesting
information. For example, you
should apply it when requesting
the employees in a specifi c
department.
add the form elements p. 47
??? The form??™s labels will serve two
purposes. First, they indicate to
the user what each form element
is for. Second, they??™ll be modi-
fi ed, using JavaScript, to indicate
an error in the Ajax-enabled version
of this form.
validate the form data p. 50
??? How you validate form data
depends on the data??™s type (numbers,
strings, etc.) and expected
values (positive number, email
address, and so on). For validating
a person??™s name, it??™s often
su?¬? cient to make sure that some
value is entered.
Pages:
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67