You didn't enter an amount for your initial amount.

"; initialForm(); }else{ //set the bank //ask the player for their first bet $_SESSION['bank'] = $_POST['bank']; bet(); } }elseif($_POST['submit']=="bet"){ //play the game //spin the kip $coin[] = rand(0,1); $coin[] = rand(0,1); $coin[] = rand(0,1); // --- 0 = Obverse // --- 1 = Reverse foreach($coin as $val){ if($val == 0){ echo ""; $obverse++; }else{ echo ""; $reverse++; } } echo "

"; //logic for winning coin if($obverse>$reverse? $winner = 0 : $winner = 1); if($_POST['selection'] == $winner){ echo "

You win!

"; echo "You have $" . $_SESSION['bank']+=$_POST['bet']; }else{ echo "

You lose! :(

"; echo "You have $" . $_SESSION['bank']-=$_POST['bet']; } bet(); } } function bet(){ ?>
Take a bet
Obverse>
Reverse>
Game set up