WatsonN Posted September 25, 2010 Share Posted September 25, 2010 I'm trying to put a variable in a header("Location: /?p=$url"); Is this even possible? Quote Link to comment https://forums.phpfreaks.com/topic/214360-variable-in-location/ Share on other sites More sharing options...
Alex Posted September 25, 2010 Share Posted September 25, 2010 Did you try it? Quote Link to comment https://forums.phpfreaks.com/topic/214360-variable-in-location/#findComment-1115505 Share on other sites More sharing options...
Pikachu2000 Posted September 25, 2010 Share Posted September 25, 2010 You can use a variable in header(), however the example wouldn't be a valid url as it's written. Quote Link to comment https://forums.phpfreaks.com/topic/214360-variable-in-location/#findComment-1115506 Share on other sites More sharing options...
WatsonN Posted September 25, 2010 Author Share Posted September 25, 2010 I did try it and it sent me to /?p=$url instead of what the variable equals. Quote Link to comment https://forums.phpfreaks.com/topic/214360-variable-in-location/#findComment-1115508 Share on other sites More sharing options...
Alex Posted September 25, 2010 Share Posted September 25, 2010 Then you're probably using single quotes instead of what you posted. You can use a variable in header(), however the example wouldn't be a valid url as it's written. Why not? Quote Link to comment https://forums.phpfreaks.com/topic/214360-variable-in-location/#findComment-1115510 Share on other sites More sharing options...
WatsonN Posted September 25, 2010 Author Share Posted September 25, 2010 AlexWD that was exactly what it was Thanks yall Quote Link to comment https://forums.phpfreaks.com/topic/214360-variable-in-location/#findComment-1115513 Share on other sites More sharing options...
Pikachu2000 Posted September 25, 2010 Share Posted September 25, 2010 Then you're probably using single quotes instead of what you posted. You can use a variable in header(), however the example wouldn't be a valid url as it's written. Why not? Something about it didn't make sense in my mind, but I just tested it and it works; I was wrong. (Stupid mind) Quote Link to comment https://forums.phpfreaks.com/topic/214360-variable-in-location/#findComment-1115527 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.