Specifications
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\”> </td>
<th align = center bgcolor=\”#cccccc\”>
$items
</th>
<th align = center bgcolor=\”#cccccc\”>
\$”.number_format($total_price, 2).
“</th>
</tr>”;
// display save change button
if($change == true)
{
echo “<tr>
<td colspan = “. (2+$images) .”> </td>
<td align = center>
<input type = hidden name = save value = true>
<input type = image src = \”images/save-changes.gif\”
border = 0 alt = \”Save Changes\”>
</td>
<td> </td>
</tr>”;
}
echo “</form></table>”;
}
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.
Building Practical PHP and MySQL Projects
P
ART V
562
LISTING 25.10 Continued
31 7842 CH25 3/6/01 3:39 PM Page 562










