Jump to content

Urlencode Giving Incorrect Url


Solarpitch

Recommended Posts

Hey Guys,

 

I'm retrieving a name from a POST and using urlencode() but it seems to be giving an incorrect url.

 

...
$sourceName = $_POST['val']; // echos here as " Conor Maynard  "
echo $url = "http://www.site.com/api/artist/details?aname=".urlencode($sourceName)."&id=mymHPtI3wp&format=xml";

 

The output is:

http://www.site.com/api/artist/details?aname=%0A++++++Conor+Maynard%0A++++&id=mymHPtI3wp&format=xml

 

If I just do $soureName = "Conor Maynard"; as hardcoded it works fine, but doesnt seem to like the value when assigned from the POST.

Link to comment
https://forums.phpfreaks.com/topic/270370-urlencode-giving-incorrect-url/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.