Hi Folks,

I created this code below that I want to use in a for loop statement with an if statement. This might not be the best way to go about it, but it does work somehow. However, I have a problem with it. When I run the page, the code runs well only I have the output 'Proceed to checkout' in infinity. It keeps echoing proceed to checkout without stopping and I get a long page with the same text message. Sometime, it crashes.

Code:
<?php 
 $accountBalance = 560;
 $cost      = 123;
 $pay       = $accountBalance - $cost;
 $msg       = "You have insufficient money in your account.";
 $accept   = "Proceed to checkout";
 $refuse    = "Credit your account to continue.";
 
 for (;;) {
   if ($pay <= $accountBalance) {
      echo $accept;
   }
     else 
   {
 if ($pay > $accountBalance)
  {
 echo $msg . $refuse;  
	}
     }
  } 
      
?>
Can someone help me out with any idea so that is echos 'Proceed to checkout' or any other output just once, please?

Thanks,
Menre