Welcome to WebmasterWorld Guest from 184.108.40.206
$input = 'url encoding';
$gsearch = urlencode($input);
print '<a href="http://www.google.com/#hl=en&q='.$gsearch.'">Google Search</a>';
The link will end up being:
(I am testing it on my computer)
Would I have to us preg_replace to take out the "http://localhost/" or is there some other way to do that?
If you need to strip out the host name, use $_SERVER['REQUEST_URI'] [us2.php.net].