Re: Escaping Characters - URL Encoding.

From: Date: Tue, 24 Apr 2001 21:38:27 +0000
Subject: Re: Escaping Characters - URL Encoding.
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-50187@lists.php.net to get a copy of this message
> I've been able to escape the 'space' character in a variable so it can > be safely passed through a URL but I'm having trouble finding anything > that works for escaping the '&' ampsand. php.net/urlencode as for your code: > $topic = "Aerospace & Commercial Space"; > > $link_value = str_replace("&", '%26', $topic); > $link_value = str_replace(' ', '%20', $topic); You are using $topic both times. Your second line should be: $link_value = str_replace(' ', '%20', $link_value); -Rasmus

« previous php.general (#50187) next »