Jump to content

php redirect


aschandra27

Recommended Posts

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

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.