Actually this is a simple thing, but many people still asking for it. “I’m trying to pass a variable in the url, but why it only passes the first word?”
The reason is you can’t pass spaces in URLs. Use rawurlencode() or urlencode to convert the spaces and other symbols into something that can be passed through the url.
$var = “Hello World”;
location = “page.php?var=” . urlencode($var);
Be First To Comment
Related Post
Leave Your Comments Below