<?php
include("connect.php");

$ISBN = $_GET["ISBN"];

$query = "SELECT * FROM item WHERE ISBN = '$ISBN'";
$result = $db->query($query);

$row = $result->fetch_array();

echo "<div id='main'>";
echo "<center>";
echo "<h3>Book Detail</h3>";
echo "</div>";

echo "<div id='bookmenu'>";
echo "<form name='q1form' method='GET' action='addcart.php'>";
echo "<table border='0' cellspacing='2' cellpadding='1' bordercolor='black' width='80%'>";

	echo "<tr>";
	echo "<td colspan='3'></td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "<th colspan='3' style='font-size:15pt'><input type='hidden' name='itemName' value='".$row["itemName"]."'>".$row["itemName"]."</th>";
	echo "</tr>";
	
	echo "<tr>";
	echo "<td rowspan='6' weight='20%' align='center'>";
	echo "<img src=/bookstore/bookstaff/".$row["itemImage"]." height='200' weight='200' style='margin:10 10 10 10'>";
	echo "</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "<th width='15%'>ISBN:</th>";
	echo "<td width='65%'><input type='hidden' name='ISBN' value='".$row["ISBN"]."'>".$row["ISBN"]."</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "<th>Author:</th>";
	echo "<td>".$row["itemAuthor"]."</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "<th>Publisher:</th>";
	echo "<td>".$row["itemPublisher"]."</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "<th>Issue Date:</th>";
	echo "<td>".$row["itemDate"]."</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "<th>Category:</th>";
	echo "<td>".$row["itemCategory"]."</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "<td align='center'><br/>";
	$tem = $row[itemQuantity];
	echo "<name='temQuantity'>";
	echo "<select name='temQuantity'>";
	for($j=1; $j<=$tem; $j++)
	{
	echo "<option value='$j'>".$j;
	echo "</option>";
	}
	echo "</select>";
	echo "<input type='submit' name='add' value='Add Cart'>";
	echo "</td>";
	echo "<th>Price:</th>";
	echo "<td><input type='hidden' name='itemPrice' value='".$row["itemPrice"]."'>RM";
	printf("%10.2f",$row["itemPrice"]);
	echo "</td>";
	echo "</tr>";
	
	echo "<tr>";
	echo "<td align='center'><br/>";
	echo "<div id='commonlink'>";
	echo "<a href='bookmenu.php'>Back To Result</a><br/>";
	echo "</div>";
	echo "<th>Available:</th>";
	echo "<td><input type='hidden' name='itemQuantity' value='".$row["itemQuantity"]."'>".$row["itemQuantity"]."</td>";
	echo "</tr>";
	
	echo "</form>";
	
	echo "<tr>";
	echo "<td colapsn='3' width='30%'>";
	
	echo "<a name='summarybox'></a>";
?>
        <a href="#" onclick="control(this)" text1="Summary">Summary</a>
		<a href="#" onclick="control(this)" text2="Rating">Rating</a>
		<a href="#" onclick="control(this)" text3="Comment">Comment</a>	
</td>
</tr>
	
	
<?php
	echo "<tr>";
	echo "<td colspan='3'>";
	echo "<div class='clear'></div>";
	echo "<div class='box2' id='content_1'>";
	echo "<b>Summary:</b>";
	echo "$row[itemSummary]";	
    echo "</div>";
	
    echo "<div class='box2' id='content_2' style='display:none'>";
	echo "<b>Rating:</b>";
	echo "normal2";
    echo "</div>";
	
	echo "<div class='box3' id='content_3' style='display:none'>";
	echo "<b>Comment:</b>";
	echo "normal3";
    echo "</div>";
	
	echo "</tr>";
	
echo "</table>";
echo "</div>";
echo "</center>";

$db->close();

?>