aschandra27 Posted July 18, 2007 Share Posted July 18, 2007 hi i am having a problem with redirect. the page which works fine with my localhost, when copied to a different server doesnt work. the code is below <? session_start(); if(!session_is_registered(myusername)){ header("location:template.php"); } ?> <html> <body> <?php header( 'Location: showrec.php' ) ; ?> </body> </html> when copied to a differnt server it stops redirecting the page and sits there. please help Quote Link to comment Share on other sites More sharing options...
Northern Flame Posted July 20, 2007 Share Posted July 20, 2007 post this in the "PHP Help" section Quote Link to comment Share on other sites More sharing options...
samtay Posted July 20, 2007 Share Posted July 20, 2007 Try this! <? session_start(); if(!session_is_registered(myusername)){ header("Location: /template.php"); } ?> What is this redirect for? It won't work as the file has already been partly sent and headers can not be sent. <html> <body> <?php header( 'Location: showrec.php' ) ; ?> </body> </html> Need to be like this, before any other HTML code that is not in "<?php ?>", has been echo, print etc <?php header( 'Location: showrec.php' ) ; ?> <html> <body> </body> </html> Unless you are thinking of include here. include will insert an file here. <html> <body> <?php include('showrec.php' ) ; ?> </body> </html> 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.