header
function to redirect a request, make sure you are using double quotes in the parameter that you supply. Example: header("Location: http://blogmodif.blogspot.com/2011/07/note-on-using-header-function-in-php.html")
and not like this:
header('Location: http://blogmodif.blogspot.com/2011/07/note-on-using-header-function-in-php.html')
which is using single quote. On both the above example, they will work though. But, when you want to use variable to set the URL, for example:
$myURL= "http://blogmodif.blogspot.com/2011/07/note-on-using-header-function-in-php.html"
and then do:
header('Location: $myURL');
will cause an error because php didn't evaluate the variable between the single quote. Only when you wrap them in the double quote, then the variable will be evaluated:
header("Location: $myURL");
will redirect to this post.
I hope this is usefull.
No comments:
Post a Comment