Passing Variable to URL returns only first word?

Discussion in 'Programming' started by jonnypixel, Jun 21, 2010.

  1. #1
    Hi, ( Thanks for any help in advance )

    I am still learning php and if some one could help i would be very grateful, cheers.

    I have a menu system and it displays on my tabs correctly but when i hover over the Names with Two words ( eg: Brown Bread )

    It only shows

    &cat=Brown ( In my URL )

    
    
     $link = 'index.php?area=mypage&cat=';
    
     $html .= '<li><a href='.$link.''.$menuData['items'][$itemId]['name'].'>' .$menuData['items'][$itemId]['name']; 
    
       // find childitems recursively
                $html .= buildMenu($itemId, $menuData);
    
                $html .= '</a></li>';
    PHP:


    Can any one please help as to how i can keep the full two words showing in my link please?

    I want it to show

    &cat=Brown Bread ( In my URL )

    I have tried variations of "\" "\" and '\' '\' But it either shows me an error or just adds it to the link URL.
     
    jonnypixel, Jun 21, 2010 IP
  2. amaroks

    amaroks Peon

    Messages:
    242
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
  3. jonnypixel

    jonnypixel Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi Amaroks,

    You are great!

    I did this and it works,

    <a href='.$link.''.(urlencode($menuData['items'][$itemId]['name'])).'>' 
    PHP:
    Question though...

    It now ads + symbols where there is space.

    Brown+Bread

    How will i remove this Plus Symbol when Inserting a new entry into the table?
     
    jonnypixel, Jun 21, 2010 IP
  4. ttyler333

    ttyler333 Member

    Messages:
    62
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    43
    #4
    ttyler333, Jun 21, 2010 IP
  5. jonnypixel

    jonnypixel Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thankyou very much,

    I will try this today or tommorow.
     
    jonnypixel, Jun 21, 2010 IP