PHP and MySQL Web Development - P113

PHP and MySQL Web Development - P113: PHP and MySQL Web Development teaches the reader to develop dynamic, secure, commercial Web sites. Using the same accessible, popular teaching style of the first edition, this best-selling book has been updated to reflect the rapidly changing landscape of MySQL and PHP. | 532 Chapter 25 Building a Shopping Cart Listing Continued echo width . size 0 3 . height . size 1 3 . else echo nbsp echo td echo td align left echo a href isbn . isbn. . book title . a by . book author echo td td align center .number_format book price 2 echo td td align center if we allow changes quantities are in text boxes if change true echo input type text name isbn value qty size 3 else echo qty echo td td align center .number_format book price qty 2 . td tr n display total row echo tr th colspan . 2 images . bgcolor cccccc nbsp td th align center bgcolor cccccc . HTTP_SESSION_VARS items . th th align center bgcolor cccccc .number_format HTTP_SESSION_VARS total_price 2 . th tr display save change button if change true echo tr td colspan . 2 images . nbsp td td align center input type hidden name save value true input type image src images border 0 alt Save Changes td td nbsp td tr echo form table Implementing the Shopping Cart 533 The basic flow of this function is as follows 1. Loop through each item in the cart and pass the ISBN of each item to get_book_details so that we can summarize the details of each book. 2. Provide an image for each book if one use the HTML image height and width tags to resize the image a little smaller here. This means that the images will be a little distorted but they are small enough that this isn t much of a problem. If it bothers you you can always resize the images using the gd library discussed in Chapter 19 Generating Images or manually generate different size images for each product 3. Make each cart entry a link to the appropriate book that is to with the ISBN as a parameter. 4. If we are calling the function with the change parameter set to true or not set it defaults to true show the boxes with the quantities in them as a form with the Save Changes button at the end. When we reuse this function after checking out we won t want the user to be able to change her

Không thể tạo bản xem trước, hãy bấm tải xuống
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
170    251    5    26-06-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.