Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,314
    Thanks
    4
    Thanked 207 Times in 204 Posts
    PHP Code:
    $YourVar str_replace(' ','',$_GET['pc']); 
    Dave .... HostMonster for all of your hosting needs

  • #3
    New to the CF scene
    Join Date
    Jan 2013
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you so much - worked perfectly!

    Thanks again,
    David

  • #4
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    738
    Thanks
    20
    Thanked 85 Times in 85 Posts
    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.
    Get Cloud Hosting now from only£59 / month

  • #5
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    738
    Thanks
    20
    Thanked 85 Times in 85 Posts
    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.
    Get Cloud Hosting now from only£59 / month


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •