PHP mysql头页刷新无限循环

I'm trying to refresh a page to update the values in a text box, but I'm getting an infinite loop.

"Firefox has detected that the server is redirecting the request for this address in a way that will never complete."

if($POST_['rem1'] != $quantity){
$query = "update cart set quantity=".$_POST['rem1'].";";
mysql_query($query);
header('Location: http://~/cart.php');

}

Does anyone have any suggestions on a way to make it execute once, or a better implementation?

Thanks!

That will never get false

if($POST_['rem1'] != $quantity){

hence the page will redirect infinitely.

it should be

if($_POST['rem1'] != $quantity){