I am working on a turn based game and I am having some difficulty making the HP counter stop counting at the specified number here is some of the code;
<?php
session_start();
$player_hp = $_SESSION['player_hp'];
$turns = $_SESSION['turns'];
$turns = $turns - 1;
?>
and this is how I was trying to stop it.
<?php
if($total_hp < 30){
$player = $player_hp + 5;
echo "You Still Have More recovery to do!";
}
else {
echo "You are fully recovered!";
}
$_SESSION['turns'] = $turns;
$_SESSION['player_hp'] = $player_hp;
?>
I know this is simple but I'm having a heck of a time getting the HP to stop counting at 30.
Also here is the code which I use to refresh the page to count it out.
<form action="safe-spot.php" method="post">
<input type="hidden" name="sub">
<input type="submit" value="Click Here">
Thanks in advance,