add an anchor next to each add to cart button:
<a name="id">Product 10</a>
and modify the add to cart form action to pass the anchor:
<form action="<?php echo ($_SERVER["PHP_SELF"]."#id=10".(isset($_SERVER["QUERY_STRING"])?"?".htmlentities($_SERVER["QUERY_STRING"]):""));?>" method="post" >
see this page for details on using the anchor name attribute:
html_links.asp