Using a variable in a header...

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

User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Using a variable in a header...

Post by Jade »

Have you tried printing out where the URL it's redirecting to?
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Using a variable in a header...

Post by oscardog »

You mean echo'ing the variables? Yeh we did that they are all perfect, it just doesn't redirect right.. :evil:
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Using a variable in a header...

Post by oscardog »

Right after giving up with the header idea, i decided well i'll try using META tags... Here is the code, and i have echo'ed the variables they all work perfectly.

Code: Select all

<?php
 
$type = $_POST['type'];
$mode = $_POST['mode'];
$year = $_POST['year'];
$month = $_POST['month'];
$host  = $_SERVER['HTTP_HOST'];
$uri   = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
 
if($type == "Planner" && $mode == "View") {
$page = "view_planner.php?month=$month&year=$year";
 
}
 
if($type == "Planner" && $mode == "Edit") {
$page = "planner_diary.php?month=$month&year=$year";
 
}
 
if($type == "Diary" && $mode == "View") {
$page = "view_diary.php?month=$month&year=$year";
 
}
 
if($type == "Diary" && $mode == "Edit") {
$page = "edit_diary.php?month=$month&year=$year";
}
 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="refresh" content="5;url=<?php echo $page ?>" />
</head>
 
<body>
<div align="center">You are now being redirected to the relevant page. You will be redirected in 3 seconds...<br />
  If you are not redirected, please click <a href="<?php echo $page; ?>">here</a>
</div>
</body>
</html>
 
Now, it goes from diarycentral.php where the form is to diaryprocess.php, which is the code shown above. It goes to diaryprocess.php, displays the message its redirecting bla bla and then for some STUPID reason it goes back to diarycentral.php where the form is, i mean WTF?

Ideas, anyone, im getting sort of desperate...
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: Using a variable in a header...

Post by papa »

What kind of PHP installation ? Wamp, Lamp, Crap ?
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Using a variable in a header...

Post by oscardog »

Well, i have no idea what Lamp and Wamp is?

But PHP version 5.2.5 ...
User avatar
novice4eva
Forum Contributor
Posts: 327
Joined: Thu Mar 29, 2007 3:48 am
Location: Nepal

Re: Using a variable in a header...

Post by novice4eva »

papa wrote:What kind of PHP installation ? Wamp, Lamp, Crap ?
Hahahah i have this naive way of trusting this forum so i admit i did a google check on CRAP hahahahahahaha

I think we should take this post straight to UFO equivalent segment of php...HEADER didn't META did!!
oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Using a variable in a header...

Post by oscardog »

Thanks for all your help, i did it, sort of... just differently :)

Thanks.
User avatar
papa
Forum Regular
Posts: 958
Joined: Wed Aug 27, 2008 3:36 am
Location: Sweden/Sthlm

Re: Using a variable in a header...

Post by papa »

novice4eva wrote:
papa wrote:What kind of PHP installation ? Wamp, Lamp, Crap ?
Hahahah i have this naive way of trusting this forum so i admit i did a google check on CRAP hahahahahahaha

I think we should take this post straight to UFO equivalent segment of php...HEADER didn't META did!!
Haha :D
Post Reply