Okay, reading through your code, I don't see anywhere where you add anything else to your cart. Also, it doesn't make sense to store a counter in your session when the counter just holds the size of an array ALSO in the session. Why not just calculate the size of the array?
Here's a simple rewrite of showcart.php:
$id = $_GET['id'];
$price = $_GET['price'];
$name = $_GET['basket']; // why is this named "basket" instead of "name"??
if (! isset($_SESSION['basket']))
$_SESSION['basket'] = array();
$_SESSION['basket'] = array('id' => $id,
'price' => $price,
'name' => $name);
// okay. no problem.
echo "basket contains<br />\n";
foreach($_SESSION['basket'] as $basket_item)
echo $basket_item['id'] . ' '
. $basket_item['name'] . ' '
. $basket_item['price'] . "\n";
:history.back()">Back to books</a>
It still needs to be cleaned up (include all the proper missing HTML tags like <html><head><body> etc...), but that's an easy exersize I leave to you.