It should do that automatically.
If it is not, there may be a php error occurring, try adding the following code at line 1 of the page:
<?php
error_reporting(E_ALL);
ini_set('display_errors','on');
?>
It would also help to have a copy of the add to cart page in a zip file so I can see the code and a link where I can see the issue in the browser.