C.9.4 Exercise 4:
Load the form element helper functions require 'formhelpers.php' if _POST '_submit_check' If validate form returns errors, pass them to show form if form errors validate form The submitted data is valid, so process it process form The form wasn't submitted, so display show form function show form errors '' if errors print 'You need to correct the following errors lt ul gt lt li gt ' print print ' lt li gt lt ul gt ' print ' lt form method POST input submit 'submit','Show File' the hidden...
11.4 Exercises
1. Using the XML document in the menu variable defined in Example 11-5, print an HTML lt ul gt list in which each list element is the lt title gt of one lt item gt in the XML document, and that lt title gt is hyperlinked to the URL listed in the lt link gt element of the item. For example, if one of the items were 3. lt title gt Steamed Rock Cod lt title gt 5. lt description gt Enjoy a cod, bursting with flavor. lt description gt lt item gt Then the corresponding list element that your code...
Example 13-13. Using the SQLite database
db if DB isError db die Can't connect . db- gt getMessage dishes db- gt getAll 'SELECT dish_name,price FROM dishes ORDER BY price' if count dishes gt 0 print ' lt ul gt ' print lt li gt dish dish name dish price lt li gt The only thing different about Example 13-13 and the answer Section C.6.1 to Exercise 7.1 Section 7.14 is the DSN supplied to DB connect . The DSN for SQLite doesn't have a username or password, and instead of a database name, the last part of the DSN is the filename of the...
Example 6-27. Setting defaults in a multivalued select menu
main dishes array 'cuke' gt 'Braised Sea Cucumber', 'stomach' gt Sauteed Pig's Stomach, 'tripe' gt 'Sauteed Tripe with Wine Sauce', 'taro' gt 'Stewed Pork with Taro', 'giblets' gt 'Baked Giblets with Salt', 'abalone' gt 'Abalone with Marrow and Duck Feet' print ' lt select name main dish multiple multiple gt ' foreach defaults 'main dish' as option selected options option true print out the lt option gt tags foreach main dishes as option gt label print ' lt option value ' . htmlentities option...