Specifications
FIGURE 25.15
The edit_book_form.php script gives the administrator access to edit book details or delete a book.
This is, in fact, the same form we used to get the book’s details in the first place. We built an
option into that form to pass in and display existing book data. We did the same thing with the
category form. To see what we mean, look at Listing 25.19.
LISTING 25.19 display_book_form() Function from admin_fns.php—This Form Does
Double Duty as an Insertion and Editing Form
function display_book_form($book = “”)
// This displays the book form.
// It is very similar to the category form.
// This form can be used for inserting or editing books.
// To insert, don’t pass any parameters. This will set $edit
// to false, and the form will go to insert_book.php.
// To update, pass an array containing a book. The
// form will be displayed with the old data and point to update_book.php.
// It will also add a “Delete book” button.
{
// if passed an existing book, proceed in “edit mode”
$edit = is_array($book);
Building a Shopping Cart
C
HAPTER 25
25
B
UILDING A
SHOPPING CART
581
31 7842 CH25 3/6/01 3:39 PM Page 581










