redirect issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
aschandra27
Forum Newbie
Posts: 3
Joined: Wed Jul 18, 2007 5:55 am

redirect issue

Post by aschandra27 »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


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

Code: Select all

<?
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


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Gente
Forum Contributor
Posts: 252
Joined: Wed Jun 13, 2007 9:43 am
Location: Ukraine, Kharkov
Contact:

Post by Gente »

1. You shouldn't use header( 'Location: showrec.php' ); after output as header are sent
2. Use '<?php' + '?>' instead of '<?' + '?>' (PHP5 required '<?php' tag)
aschandra27
Forum Newbie
Posts: 3
Joined: Wed Jul 18, 2007 5:55 am

thank you

Post by aschandra27 »

tried even that approach. the whole bunch of files are having problem with redirect. its able to redirect it back , but not to front. the scripts running on my local machine/local server are fine.. but on remote getting all kind of redirect problems.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Have you read the Tutorial we've had available for several years?
Post Reply