Thus,
the data specified in the $xmlResponse object with addAssign
method is set in the input form.
The updateCatalog($formValues) function is used to update
database table Catalog from the input form. If the Catalog Id field value
is valid, a new catalog entry may be created by adding values to the other
fields of the form. Click on the Create Catalog button to submit the form.
The onsubmit event handler invokes the wrapper function
xajax_updateCatalog, which sends an XMLHttpRequest to the
server.
onsubmit=???xajax_updateCatalog(xajax.getFormValues(???v
alidationForm??™));"
The xajax object receives the XMLHttpRequest and invokes the
corresponding PHP function updateCatalog($formValues). In the
updateCatalog function, retrieve the form field values and create an
SQL statement to add a row to database table Catalog. Obtain a
connection with the database and run the SQL statement. The input.php
script is listed below.
$xajax = new xajax();
$xajax->cleanBufferOn();
$xajax->registerFunction(???validateCatalogId???);
$xajax->registerFunction(???updateCatalog???);
function validateCatalogId($formValues){
$objResponse = new xajaxResponse();
$catalogId=trim($formValues[???catalogId??™]);
$username=??™OE??™;
8.7 Processing the Ajax Response 173
$password=??™password??™;
$db=??™(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =
localhost)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ORCL)
)
)';
$connection = oci_connect($username, $password, $db);
$stmt = oci_parse($connection, ???SELECT * from
OE.
Pages:
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160