SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    calling array in url error

    Hi guys

    I'm calling a array from my database

    its a list of categories. Words like Construction are fine. But when its like
    Media & Creative or Recruitment Consultancy

    it stops displaying anything after the first word



    it displays it ok when im printing it out, but when I call it in the url (please point your cursor over a two worder)

    It only shows the first word


    Thanks in advance for your help

  2. #2
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    How does the html source look like?
    Saul

  3. #3
    SitePoint Guru
    Join Date
    Oct 2004
    Location
    uk
    Posts
    853
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    <?php



    $id 
    $_GET['id'];
    $sql " select * from category ORDER BY category ASC";
    $result mysql_query ($sql);

    $i 0;
    $row mysql_fetch_array$result );

    echo 
    "<table width=100%><tr><td>";
    while( 
    $i<18 ) {
        echo 
    "<font size=2><A href=sector.php?category=$row[category]>$row[category]</a><br>";
        
    $row mysql_fetch_array$result );
        
    $i++;
    }

    echo 
    "</td>";
    echo 
    "<td>";

    while( 
    $i >= 18 && $i<36 ) {
        echo 
    "<font size=2><A href=sector.php?category=$row[category]>$row[category]</a><br>";
        
    $row mysql_fetch_array$result );
        
    $i++;
    }

    echo 
    "</td></tr></table>";


    ?>

  4. #4
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I asked about the html source for a reason. If you checked that, the links would look like this:
    Code:
    <A href=sector.php?category=Recruitment Consultancy>Recruitment Consultancy</a>
    You can see what's wrong?

    Quote the urls:
    Code php:
    echo "<font size=2><A href=\"sector.php?category=$row[category]\">$row[category]</a><br>";
    Saul

  5. #5
    SitePoint Evangelist
    Join Date
    Aug 2005
    Posts
    453
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use urlencode() to encode your get data parameters. The blank space will need to be replaced with a +.
    Documentation @ : http://us.php.net/urlencode
    Computers and Fire ...
    In the hands of the inexperienced or uneducated,
    the results can be disastrous.
    While the professional can tame, master even conquer.


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
  •