MANAGING CONTENT The Update entry button (Top ten web hosting) doesn t do

MANAGING CONTENT The Update entry button doesn t do anything yet. Just make sure that everything is displayed correctly, and confirm that the primary key is registered in the hidden field. You can check your code, if necessary, against journal_update_mysql01.php. Figure 13-4. An update form uses the primary key to retrieve and display a record ready for editing. 7. The name attribute of the submit button is update, so all the update processing code needs to go in a conditional statement that checks for the presence of update in the $_POST array. Place the code highlighted in bold just before the page redirect script: $row = mysql_fetch_assoc($result); } // if form has been submitted, update record if (array_key_exists(’update’, $_POST)) { // prepare expected items for insertion into database foreach ($_POST as $key => $value) { if (in_array($key, $expected)) { ${$key} = mysql_real_escape_string($value); } } // abandon the process if primary key invalid if (!is_numeric($article_id)) { die(’Invalid request’); } 363
Note: In case you are looking for affordable and reliable webhost to host and run your j2ee application check Vision J2ee Web Hosting services.

Leave a Reply