/** * Displays a single item in a row of the table. * * @param $id The product ID * @param $prodName The name of the product * @param $price The individual selling price of the item * @param $qty The quantity of this item in the shopping cart */ function showItem($id, $prodName, $price, $qty) { echo "<tr>\n"; echo "<td>{$prodName}</td>\n<td>\$" . number_format($price, 2) . "</td>\n<td>"; $f = new FormLib(); $data = array(); for ($i = 1; $i <= MAX_QTY; $i++) { $data[$i] = $i; } $other = 'onChange="updateQty(this)"'; $opt = $f->makeSelect($id, $data, $qty, $other); echo "{$opt}</td>\n<td>\$" . number_format($price * $qty, 2) . "</td>\n"; echo "<td>"; echo '<button name="' . $id . '" value="delete" onclick="updateQty(this)">'; echo "Delete</button>"; echo "</td>\n"; echo "</tr>\n"; }