takn25 Posted February 8, 2011 Share Posted February 8, 2011 Hi, i would like to encode a url example. $error="You must be signed in"; $enc=urlencode("http://localhost/finxed/asku/asked.php?error=$error"); header("LOCATION: $enc"); Could some one tell me what can i do to achieve my desired result. I want the header to take to the LOCATION, which is $enc but i wanted it to be encoded when displayed in the url field. The current code is not working. Link to comment https://forums.phpfreaks.com/topic/227007-encoding-a-url-and-using-in-a-header/ Share on other sites More sharing options...
Pikachu2000 Posted February 8, 2011 Share Posted February 8, 2011 What about it "isn't working"? Link to comment https://forums.phpfreaks.com/topic/227007-encoding-a-url-and-using-in-a-header/#findComment-1171212 Share on other sites More sharing options...
takn25 Posted February 8, 2011 Author Share Posted February 8, 2011 I get object not found(page not found) with the encoded url but when i try with out encoding it works fine. Link to comment https://forums.phpfreaks.com/topic/227007-encoding-a-url-and-using-in-a-header/#findComment-1171215 Share on other sites More sharing options...
Pikachu2000 Posted February 8, 2011 Share Posted February 8, 2011 The only thing you would likely need to use urlencode() on would be the $error variable. Give this a try. $enc=urlencode($error); header("Location: http://localhost/finxed/asku/asked.php?error=$enc"); Link to comment https://forums.phpfreaks.com/topic/227007-encoding-a-url-and-using-in-a-header/#findComment-1171249 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.