Log in

View Full Version : redirect with header and Dynamic URL



noobster
02-13-2008, 02:15 PM
Hi everybody,

Could someone tell me what i'm forgetting in there?


header('refresh:5;url=suivant.php?ID_info=$row_Promo_val_suiv['ID_info']');

It returns me :


Parse error: parse error, unexpected T_STRING in c:\program files\easyphp1-8\www\passage_sessions\suivants.php on line 53

My variable works because without the redirection it shows the correct value.
I guess it must be stupid :p

Thanks for any help .


Solution applied:

$urlsuivant = "promo.php?ID_promo=" .$row_promos['ID_info'];


header("refresh:5;url= $urlsuivant");

Jas
02-14-2008, 03:26 AM
Not that you need it now, but the problem was

header('refresh:5;url=suivant.php?ID_info=$row_Promo_val_suiv['ID_info']');

Should be
header('refresh:5;url=suivant.php?ID_info='.$row_Promo_val_suiv['ID_info'].'');

You string started with ' and had ' in the middle, causing the parse error. Also, the value won't be placed in a string if its in single quotes, and an array value won't be in a string unless you concat it in.
You got it right in the second bit of code, which is why it works :)

noobster
02-14-2008, 10:00 AM
Thanks anyway for the reply, it gives me a bit more of explanation. and also another way wich is always good to know :)

thanks