SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Addict sstaubin01's Avatar
    Join Date
    Nov 2000
    Location
    Ont, Canada
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm using the <a> tag to pass a php variable to another page. The varaible is a text string that could include spaces. example:

    $var = 'aaa bbb';
    <A HREF="newpage.php?var=<?php echo($var); ?></A>

    IE handles this fine receiving $var on newpage.php as
    'aaa bbb' but Netscape only receives $var as 'aaa'.

    I know the the URL and passed variables should be a continious string hence the reason for ? and & to attach the string but how do you handle an assigned varaible that has white space in the string?

  2. #2
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try:

    $var = 'aaa bbb';
    <A HREF="newpage.php?var=<?php echo(urlencode($var)); ?></A>

    It is a deviation from standards for IE to support variables with space in them.
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  3. #3
    SitePoint Addict sstaubin01's Avatar
    Join Date
    Nov 2000
    Location
    Ont, Canada
    Posts
    234
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Karl. EI's deviations from standards seem more flexable on the surface but don't help in the end. They don't make our lives easier do they?


Bookmarks

Posting Permissions

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