I am just learning php coding and I have made a bank script for a small online game I am trying to create.
Before I added the if and else to the code to limit a user from depositing or withdrawing more money than they had. The Submit button would either add money to the users account, minus a 2% deposit fee. Or the user could withdraw money from their account with no penalties. Now all that happens is the page comes up blank.
Here is my main bank page code.
[php] <?php
include(“safe.php”);
?>
Would you like to Deposit or Withdraw some money.
The deposit fee is 2%.
The bank has no penalty for a withdraw.You have $<?php echo $stats['bank']; ?> in the bank right now.
You have $<?php echo $stats['gold']; ?> in your pocket right now.
<form name="input" action="bank_action.php" method="post">
Amount to Deposit
This is the page I think the problem is occurring in.
[php]<?php
include(“safe.php”);
if(!isset($_POST[‘withdraw’])){
$withdraw = $_POST[‘withdraw’];
$total1 = $withdraw;
$round1 = floor($total1);
if($total1 > $stats[‘bank’]);{
echo(“You don’t have that much money in the bank! Go back and try entering a real number!”);
}if($total1 < $stats[‘bank’]);
$pocket1 = mysql_query(“UPDATE stats
SET gold
=gold
+’”.$total1."’ WHERE id=’$_SESSION[uid]’") or die(mysql_error());
$bank1 = mysql_query(“UPDATE stats
SET bank
=bank
-’”.$total1."’ WHERE id=’$_SESSION[uid]’") or die(mysql_error());
header(“Location: bank_succ.php”);
}
else{
if(!isset($_POST[‘deposit’])){
$deposit = $_POST[‘deposit’];
$percent = 2;
$total = $deposit;
$tmppercent=100-$percent;
$equals=($total / 100 * $tmppercent);
$round = ceil($equals) ;
$depos = ($total - $round);
if($total < $stats[‘gold’]);{
echo(“You don’t have that much money in your pocket! Go back and try entering a real number!”);
}if(total > $stats[‘gold’]);
$pocket = mysql_query(“UPDATE stats
SET gold
=gold
-’”.$total."’ WHERE id=’$_SESSION[uid]’") or die(mysql_error());
$bank = mysql_query(“UPDATE stats
SET bank
=bank
+’”.$round."’ WHERE id=’$_SESSION[uid]’") or die(mysql_error());
header(“Location: bank_succ.php”);
}
}
?>[/php]
And the last page that is in the program is the success page.
[php] <?php
echo “You now have $”.$stats[‘gold’]." in your pocket right now.
“;
echo “You now have $”.$stats[‘bank’].” in your account now."
?> [/php]
I am hoping it is something simple. Any ideas or even a link to a page that might give me a clue. I have been trying to get this portion resolved for a few days now. Any help would be appreciated.