Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-18-2013, 12:58 AM   PM User | #1
davblackpool
New to the CF scene

 
Join Date: Jan 2013
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
davblackpool is an unknown quantity at this point
Removing 'spaces' from GET variable

Hi Everyone,

I'm stuck on this question and hoping someone can help.

I've got part of our site that is post code driven, however, for an incoming RSS feed I need to ensure that the post code has no space in the middle.

Is there a simple way to remove this space?

Currently the GET variable is pulled from a pc=AB1 2AA from the URL.

Any help is much much appreciated.

Thanks,
David
davblackpool is offline   Reply With Quote
Old 02-18-2013, 12:35 PM   PM User | #2
djm0219
Senior Coder

 
djm0219's Avatar
 
Join Date: Aug 2003
Location: Wake Forest, North Carolina
Posts: 1,229
Thanks: 2
Thanked 190 Times in 188 Posts
djm0219 is on a distinguished road
PHP Code:
$YourVar str_replace(' ','',$_GET['pc']); 
__________________
Dave .... HostMonster for all of your hosting needs
djm0219 is offline   Reply With Quote
Old 02-18-2013, 10:39 PM   PM User | #3
davblackpool
New to the CF scene

 
Join Date: Jan 2013
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
davblackpool is an unknown quantity at this point
Thank you so much - worked perfectly!

Thanks again,
David
davblackpool is offline   Reply With Quote
Old 02-19-2013, 01:39 PM   PM User | #4
Arcticwarrio
Regular Coder

 
Arcticwarrio's Avatar
 
Join Date: May 2012
Location: UK
Posts: 624
Thanks: 16
Thanked 70 Times in 70 Posts
Arcticwarrio is on a distinguished road
Quote:
Originally Posted by djm0219 View Post
PHP Code:
$YourVar str_replace(' ','',$_GET['pc']); 
you can also store it straight into $_GET['pc']

PHP Code:
$_GET['pc'] = str_replace(' ','',$_GET['pc']); 
__________________
There are 10 types of people on CodingForums,
Those who understand Binary and those who dont.
Arcticwarrio is offline   Reply With Quote
Old 02-19-2013, 01:49 PM   PM User | #5
Arcticwarrio
Regular Coder

 
Arcticwarrio's Avatar
 
Join Date: May 2012
Location: UK
Posts: 624
Thanks: 16
Thanked 70 Times in 70 Posts
Arcticwarrio is on a distinguished road
you can also clear spaces from all GET's

PHP Code:
foreach($_GET as $NAME => $VALUE){
$_GET[$NAME] = str_replace(' ','',$VALUE);

__________________
There are 10 types of people on CodingForums,
Those who understand Binary and those who dont.
Arcticwarrio is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:57 PM.


Advertisement
Log in to turn off these ads.