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 Link to comment https://forums.phpfreaks.com/topic/131115-form-submit/ 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. Link to comment https://forums.phpfreaks.com/topic/131115-form-submit/#findComment-680911 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.