when the condition is true not go stop the code PHP

How can i stop the code if $MinimumPay  >  $payment  is true then the code stop not go to another line



   if( $MinimumPay  >  $payment  )
      {  echo " you need to pay   $MinimumPay ";
      echo "<input name='Cancel' type='button' id='button2' value='cancel' onClick='history.go(-1)' /> " ;
      }
    if( $payment < 0  )
      {  echo "can not less than 0 ";
      echo "<input name='Cancel' type='button' id='button2' value='cancel' onClick='history.go(-1)' /> " ;
      }      
teeraAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ashish PatelCommented:
write exit(); where you want to stop.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ashish PatelCommented:
or use
exit;
where you want to stop.
0
brakk0Commented:
Try this:
if( $MinimumPay  >  $payment  )
      {  echo " you need to pay   $MinimumPay ";
      echo "<input name='Cancel' type='button' id='button2' value='cancel' onClick='history.go(-1)' /> " ;
      } else {
    if( $payment < 0  )
      {  echo "can not less than 0 ";
      echo "<input name='Cancel' type='button' id='button2' value='cancel' onClick='history.go(-1)' /> " ;
      }
}      

Open in new window

0
hernst42Commented:

if( $MinimumPay  >  $payment  ) {
  echo " you need to pay   $MinimumPay ";
  echo "<input name='Cancel' type='button' id='button2' value='cancel' onClick='history.go(-1)' /> " ;
} else if( $payment < 0  ) {
  echo "can not less than 0 ";
  echo "<input name='Cancel' type='button' id='button2' value='cancel' onClick='history.go(-1)' /> " ;
} else {
  echo "<input name='Pay' type='button' id='button2' value='pay'>" ;
}

Open in new window

0
Cornelia YoderArtistCommented:
if( $MinimumPay  >  $payment  )
   exit();
else
   //continue your code as normal


If you have database connections open or the like, you may wish to close them.

You might also have some kind of place to go, like this:


if( $MinimumPay  >  $payment  )
{
   mysql_close();
   include "../errorscreen.php"
   exit();
}
else
{
  //continue your code as normal
}
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
PHP

From novice to tech pro — start learning today.