Recreational_Champ Posted November 2, 2008 Share Posted November 2, 2008 Hello all~ I have made a php game printing out images using a multidimensional array stored within a session variable named 'board.' I am having quite some time trying to navigate the current state of my player. <form action="this.php" method="get" accept-charset="utf-8"> <input type="submit" name="right" value="→"> <input type="submit" name="left" value="←"> <input type="submit" name="up" value="↑"> <input type="submit" name="down" value="↓"> <input type="submit" name="reset" value="reset;"> </form> if(isset($_GET['right'])) { $dir = "right"; move($dir); } if(isset($_GET['left'])) { $dir = "left"; move($dir); } if(isset($_GET['up'])) { $dir = "up"; move($dir); } if(isset($_GET['down'])) { $dir = "down"; echo "$dir"; } if(isset($_GET['reset'])) { session_destroy(); setcookie(session_name(),"", time() - 3600); $_SESSION=array(); echo "reset"; Now, I can move the player in any direction I choose, but I have to hit the submit button "twice" to get the player to move only after I have moved in a different direction. Example: New session started, player in a random position... Try to navigate player up/down/left/right and it will move in the direction I last clicked "once" before moving the current selection... even when cookies/sessions have been cleared. Somehow the submit GET status retains last moved state; I am one click behind and cannot figure it out My move() is working just fine! Problem occurs when I submit reset as well. A walk through would be very helpful Thanks Quote Link to comment Share on other sites More sharing options...
Recreational_Champ Posted November 3, 2008 Author Share Posted November 3, 2008 I have had many views and no responses, does this post make sense? Is the question so obvious that no one will respond? Any help will be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.