Total Items:
Total Price: $


"; } echo ""; echo "
"; } function do_html_url ($url, $title) { ?> "; if (! is_array($book_array)) { echo "No books currently available in this category"; } else { $codebase = "http://www.cs.indiana.edu/classes/a114-dger/fall2001/lectures/nine"; echo ""; foreach ($book_array as $row) { $url = "show_book.php?isbn=".($row["isbn"]); echo ""; } echo "
"; $title = ""; do_html_url($url, $title); $hand = "http://www.cs.indiana.edu/classes/a113-dger/left.gif"; echo " This is the very famous book (" . "" . $row["isbn"] . "" . ") and information about it will be available here soon, including price, " . " author, number of pages, ordering information, publisher, and what not. " . " For now, this is a placeholder, as you may have realized already. But in " . " place of it you will soon see a link that will allow you to view the " . " details about this book so you can add it to your cart if so desire. "; echo "
"; } echo "
"; } function display_button($target, $image, $alt) { echo "
\"$alt\"
"; } function get_book_details($isbn) { if (!$isbn || $isbn=="") return false; $conn = db_connect(); $query = "select * from dgerman_php_books where isbn='$isbn'"; $result = @mysql_query($query); if (!$result) return false; $result = @mysql_fetch_array($result); return $result; } function display_book_details($book) { if (is_array($book)) { $codebase = "http://www.cs.indiana.edu/classes/a114-dger/fall2001/lectures/nine"; echo ""; echo ""; echo "
"; echo "
Author: "; echo $book["author"]; echo "
ISBN: "; echo $book["isbn"]; echo "
Our Price: $"; echo number_format($book["price"], 2); echo "
Description:
"; echo $book["description"]; echo "
"; } else echo "The details of this book cannot be displayed at this time."; } function calculate_price($cart) { $price = 0.0; if(is_array($cart)) { $conn = db_connect(); foreach($cart as $isbn => $qty) { $query = "select price from dgerman_php_books where isbn='$isbn'"; $result = mysql_query($query); if ($result) { $item_price = mysql_result($result, 0, "price"); $price +=$item_price*$qty; } } } return $price; } function calculate_items($cart) { $items = 0; if(is_array($cart)) { foreach($cart as $isbn => $qty) { $items += $qty; } } return $items; } function display_cart($cart, $change = true) { global $items; global $total_price; echo ""; foreach ($cart as $isbn => $qty) { $book = get_book_details($isbn); echo ""; echo "\n"; } echo ""; if($change == true) { $codebase = "http://www.cs.indiana.edu/classes/a348/fall2001/bookstore"; echo ""; } echo "
Item PriceQuantity Total
"; echo "".$book["title"]." by ".$book["author"]; echo "$".number_format($book["price"], 2); echo ""; if ($change == true) echo ""; else echo $qty; echo "$".number_format($book["price"]*$qty,2)."
  $items \$".number_format($total_price, 2). "
 

 


"; } function display_checkout_form() { ?>
Your Details
Name
Address
City/Suburb
State/Province
Postal Code or Zip Code
Country
Shipping Address (leave blank if as above)
Name
Address
City/Suburb
State/Province
Postal Code or Zip Code
Country
Please press Purchase to confirm your purchase, or Continue Shopping to add or remove items

"; } ?>