Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <HTML>
- <HEAD><TITLE>PHP form processor</TITLE></HEAD>
- <BODY BGCOLOR = 'white'>
- <?php
- //Create start game condition
- if(){
- $pin = array("A" => array(0,1,2), "B" => array(),"C" => array());
- }else{
- //if the game has already started
- //perform a few checks
- //is the row that you are getting from empty? is the disk smaller that you are moving smaller than the one in the "to" column
- if( (count($pin[$_GET["from"]) => 0) || ($pin[$_GET["from"]][0] < $pin[$_GET["to"]][0])){
- // remove disk from the to array
- array_shift($_GET["from"]);
- // add disk to array
- array_unshift($_GET["to"]);
- }
- }
- ?>
- <!-- shift unshift to add or remove circles form array -->
- <!-- A=0,1,2&B= &C= -->
- <img src= "draw.php?A="<?php echo implode(",", $pin["A"]); ?>
- "&B="<?php echo implode(",", $pin["B"]); ?>
- "&C="<?php echo implode(",", $pin["C"]); ?>
- ">
- <form action = "play.php" method = "GET">
- Move a disk from pin <input type = "text" name ="from">
- to pin <input type = "text" name = "to">
- <input type = "submit" value = "Move">.
- </form>
- </BODY>
- </HTML>
Advertisement
Add Comment
Please, Sign In to add comment