For this query,
that would be INSERT INTO
employees (department_id,
first_name, last_name,
email, phone_ext) VALUES
($did, ???$fn??™, ???$ln??™,
???$e??™, $ext).
58 adding records
In the previous chapter, we created a way to add employees to the database.
That process required one HTML form and one PHP script that handled the
form. It all works fi ne but in the old-fashioned, client-server kind of way.
In this chapter, let??™s set an Ajax layer on top of those scripts so that, for the
browsers that support it, our form for adding employees can behave more like a
desktop application. To do so, we??™ll need to slightly modify the HTML page.
Then we??™ll create one JavaScript fi le that has the page-specifi c Ajax functionality.
Finally, a new PHP script will be written that handles the Ajax request.
This example will also introduce two new techniques: sending an Ajax request
using the POST method and working with XML data. This Ajax example is
a little more complicated than the previous one, but it should all make sense by
the end of the chapter.
5. adding records
via Ajax
59
what we??™ll do
1 First, on pages 62, we??™ll modify the HTML page to
include the necessary Ajax pieces.
Pages:
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69