Shiny_Charizard Posted February 1, 2008 Share Posted February 1, 2008 <?PHP SESSION_START(); include('connect.php'); $Member1 = mysql_query("SELECT * FROM members WHERE username='$username'"); $Member = mysql_fetch_array($Member1); //Variables $username = $_SESSION[username]; $Dir = $_GET["Dir"]; $Value_X = $Member[map_pos_X]; //Right or Left $Value_Y = $Member[map_pos_Y]; //Up or Down if($Dir == "Down") //If user chose to go Down { $Value_Y = $Value_Y--; mysql_query("UPDATE members SET map_pos_Y='$Value_Y' WHERE username='$username'"); } elseif($Dir == "Up") //If user chose to go Up { $Value_Y = $Value_Y++; mysql_query("UPDATE members SET map_pos_Y='$Value_Y' WHERE username='$username'"); } elseif($Dir == "Right") //If user chose to go Right { $Value_X = $Value_X--; mysql_query("UPDATE members SET map_pos_X='$Value_X' WHERE username='$username'"); } elseif($Dir == "Left") //If user chose to go Left { $Value_X = $Value_X++; mysql_query("UPDATE members SET map_pos_X='$Value_X' WHERE username='$username'"); } header("Location: http://tpfrpg.ghostblade.us/bmap.php"); // This is to prevent refreshing ?> How can I make the page redirect the user to http://tpfrpg.ghostblade.us/bmap.php after it has done the if statements? Any help will be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/88978-solved-help-please/ Share on other sites More sharing options...
Wolphie Posted February 1, 2008 Share Posted February 1, 2008 You should just use a <meta> tag - If that's what i think you mean. Example: <?php echo '<meta http-equiv="refresh" content="5;directory/file.php">'; echo 'You will now be re-directed in 5 seconds. <br />'; echo 'If you are not re-directed, please <a href="directory/file.php">Click Here</a>.'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/88978-solved-help-please/#findComment-455682 Share on other sites More sharing options...
revraz Posted February 1, 2008 Share Posted February 1, 2008 Actually, there doesn't appear to be anything wrong with your initial code, unless you are getting a header error. Quote Link to comment https://forums.phpfreaks.com/topic/88978-solved-help-please/#findComment-455685 Share on other sites More sharing options...
Wolphie Posted February 1, 2008 Share Posted February 1, 2008 I agree, i assumed he was getting header errors. Quote Link to comment https://forums.phpfreaks.com/topic/88978-solved-help-please/#findComment-455696 Share on other sites More sharing options...
Shiny_Charizard Posted February 1, 2008 Author Share Posted February 1, 2008 Yeah I'm getting a header error and it doesn't do the if statements. Quote Link to comment https://forums.phpfreaks.com/topic/88978-solved-help-please/#findComment-455700 Share on other sites More sharing options...
revraz Posted February 1, 2008 Share Posted February 1, 2008 Change $username = $_SESSION[username]; to $username = $_SESSION['username']; What sets "Dir" here, a URL or a Form? $Dir = $_GET["Dir"]; echo $Dir after you set it and see what it contains. Quote Link to comment https://forums.phpfreaks.com/topic/88978-solved-help-please/#findComment-455707 Share on other sites More sharing options...
Shiny_Charizard Posted February 1, 2008 Author Share Posted February 1, 2008 Change $username = $_SESSION[username]; to $username = $_SESSION['username']; What sets "Dir" here, a URL or a Form? $Dir = $_GET["Dir"]; echo $Dir after you set it and see what it contains. A url sets "Dir". Quote Link to comment https://forums.phpfreaks.com/topic/88978-solved-help-please/#findComment-455710 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.