jackr1909 Posted April 8, 2011 Share Posted April 8, 2011 hi, i was wondering if i could automattically redirect a page to another page directly based on a PHP variable like so: <?php header("Location: http://www.mywebsite.com/<?php echo $_POST["username"]; ?>.php"); ?> OR <?php header("Location: http://www.mywebsite.com/profile.php+action=<?php echo $_POST["username"]; ?>; ?> this page already exists. This is already protected. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/233145-url-redirect-with-php-variable/ Share on other sites More sharing options...
dcro2 Posted April 8, 2011 Share Posted April 8, 2011 You're already in a php block, so no need to start another just to put in a variable: <?php header("Location: http://www.mywebsite.com/".$_POST["username"].".php"); ?> http://php.net/manual/en/language.operators.string.php Quote Link to comment https://forums.phpfreaks.com/topic/233145-url-redirect-with-php-variable/#findComment-1199022 Share on other sites More sharing options...
jackr1909 Posted April 8, 2011 Author Share Posted April 8, 2011 thankyou very much Quote Link to comment https://forums.phpfreaks.com/topic/233145-url-redirect-with-php-variable/#findComment-1199025 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.