Jump to content

Recommended Posts

I have something that looks like this:

 

<a href="http://www.mysite.com/nation.php?country=Bosnia & Herzegovina">

 

The country listing at the end of the link is generated out of a database.  Ofcourse, this doesn't really work.  I can't have spaces in the link, but that is how the names have to be in the database.  Is there any php command, or series of commands, that can help me get around this without having to insert '20%' into the link?  Because 'Bosnia & Herzegovina' is really a value from a database, and for other reasons, I can't have 20%'s in there.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/138600-solved-spaces-and-_get-and-_post/
Share on other sites

Yeah, sorry, ofcourse.  The only thing is that I cannot have fillers like this at all.  I need actual spaces in there because in most instances I use that database to output the data as plain text, and not html, and if I replace spaces with %20 then all text will contain this html.

Thanks very much for all the replies.  I have incorporated urlencode() and urldecode() into the page, and it works beautifully, so thanks MadTechie.

 

premiso, thanks for your idea.  I can see that it would work.  However, after having consulted the PHP manual for urlencode() and urldecode() this was the simplest route for me.  Thanks anyways.

 

I love this site.  Thanks guys.

Thanks very much for all the replies.  I have incorporated urlencode() and urldecode() into the page, and it works beautifully, so thanks MadTechie.

 

premiso, thanks for your idea.  I can see that it would work.  However, after having consulted the PHP manual for urlencode() and urldecode() this was the simplest route for me.  Thanks anyways.

 

I love this site.  Thanks guys.

 

Eh no worries. Better to have 5 different choices than just one.

 

If you are looking for SEO Friendly I would recommend my idea and even replace the & with and. If not MadTechie way works great and is probably easier to implement!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.