Using get with special characters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gouletpo
    New Member
    • Sep 2006
    • 2

    #1

    Using get with special characters

    Hello everyone and thank you for taking the time to read this.

    I am fairly new to php and I have a problem I haven't been able to solve. For my web site, I have to send two variables to browse.php. When I build the 'a' tag, I do it like this :
    $out = '<a href="browse.ph p?path=' . $path . '&image=' . $image . '">';

    In browse.php, I get the values using :
    $path = $_GET["path"];
    and
    $image = $_GET["image"];

    Now, in most cases, this works just fine. But when $path contains an ampersand (&), it doesn't work anymore because it thinks it's a separator. Is there anyway for me to make this work ?

    Thanks again.
  • gouletpo
    New Member
    • Sep 2006
    • 2

    #2
    anybody ?

    is it even possible ?

    Comment

    • Gaz
      New Member
      • Oct 2006
      • 1

      #3
      dude,
      try and use the urlencode function to pass the value.

      eg:
      $out = '<a href="browse.ph p?path=' . $path . '&image=' . urlencode($imag e) . '">';

      Comment

      Working...