Jump to content

[SOLVED] Spaces and $_GET and $_POST


xProteuSx

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!

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.