Hello,
I am learning PHP by creating a small project to play the Card game WAR. On the page I have the user click DRAW. The program than pulls a function from another PHP file that picks a random number from a deck and then uses that number within a SWITCH statement to assign to a name card such as 4C = four of clubs. I am able to two cards returned back to an array on my main page in display it. One for the computer and one for the user. Later I will write the code for who wins. The first draw is successful but a repeated draw does not seem to do anything. I have included the .php code. Any information or hints will be greatly appreciated with a virtual Guinness.
Thanks in advance.
website: http://www.battlescapes.com/CardGame/frontpage.php
<?php
include ('header.html');
include('cardfunctions.php');
if (isset($_POST['submitted'])){//User did click.
$twocards = create_newdeck();
echo '
<table width = "400" align="center">
<tr>
<td width="200" align="center"><b>Computers Cards</b></td>
<td width="200" align="center"><b>Users Cards</b></td>
</tr>
<tr>
<td width="200" align="center">' . $twocards[0] . '</td>
<td width="200" align="center">' . $twocards[2] . '</td>
</tr>
</table>';
}else{ // USER DID NOT CLICK.
echo '<p align="center"><b>Please draw a card.</b></p>';
}//END OF if (isset($_POST['submitted'])) statement
?>
<form action = "war.php" method="post">
<table width="770" align="center" cellpadding="5" cellspacing="5">
<tr>
<td align="center"><input type="submit" name="submit" value="Draw"/></td>
</tr>
</table>
<input type="hidden" name="submitted" value="TRUE"/>
</form>
<?php
include('footer.html');
?>