variables and headers

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
timoteo
Forum Contributor
Posts: 125
Joined: Sat Jan 08, 2011 6:46 am

variables and headers

Post by timoteo »

Hi, Can anyone help me here - I can't pass the variable in my header redirect.
If I echo $MM_redirectLoginSuccess it echos fine : mipagina.php?id=106
However in the url it comes up withouth the variable: mipagina.php?id=
thanks in advanced

Code: Select all

 $ent = $_GET['id'];
  $MM_redirectLoginSuccess = "mipagina.php?id=$ent";

 header("Location: " . $MM_redirectLoginSuccess );

Dodon
Forum Commoner
Posts: 64
Joined: Wed Aug 03, 2011 4:11 am
Location: Netherlands

Re: variables and headers

Post by Dodon »

The code above works fine for me, make sure that $_GET['id'] return a value.

first try to replace $ent = $_GET['id']; by $ent = 106;

if that works your $_GET['id'] is probably empty.

I copied your code and it works fine as long as $_GET['id'] contains a value.
timoteo
Forum Contributor
Posts: 125
Joined: Sat Jan 08, 2011 6:46 am

Re: variables and headers

Post by timoteo »

if I echo $MM_redirectLoginSuccess it echos mipagina.php?id=106 so $_GET['id'] contains the value and the variable $MM_redirectLoginSuccess is complete. just won't echo the value in the url it reopens
timoteo
Forum Contributor
Posts: 125
Joined: Sat Jan 08, 2011 6:46 am

Re: variables and headers

Post by timoteo »

...
Last edited by timoteo on Sat Aug 06, 2011 12:48 pm, edited 1 time in total.
timoteo
Forum Contributor
Posts: 125
Joined: Sat Jan 08, 2011 6:46 am

Re: variables and headers

Post by timoteo »

thanks you were right. $_GET['id'] was empty. - 2am isn't right moment to do this. got it now. as always looking in the wrong place and wrong page. never mind.
Post Reply