I am doing a php variable deceleration in url
i have piece of code
$message = "Username or password is not correct.";
header("Location:".echo get_site_url()."/UI/user/index.php?message={$message}");
Where get_site_url() is
$GLOBAL_URL_OF_THE_SITE= "http://webfaction";
function get_site_url(){
global $GLOBAL_URL_OF_THE_SITE;
return $GLOBAL_URL_OF_THE_SITE;
}
Now I want to redirect the header on location
header("Location:http://webfaction/UI/user/index.php");
But why my code is giving this error
Parse error: syntax error, unexpected 'echo' (T_ECHO) in /opt/lampp/htdocs/UI/user/index.php on line 156
You can use
sprintfto format your string properlyTry