how to hide query string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • XeonYk
    New Member
    • Nov 2006
    • 5

    how to hide query string

    i have a page1 and page2.

    in the page on a have this php code :

    Code:
    $query = "select code, name from mscustomer";
    
    $rs = mysql_query($query);
    
    while($row = mysql_fetch_array($rs))
    {
         echo "<a href=\"detail.php?id=".$row['code']."\">".$row['name']."</a>";
    }
    example data :

    justin
    harry
    david

    when i click justin it will redirect to page 2, but i don't want to show the querystring url in page 2 -> detail.php

    but when in page2 i use echo $id
    it will print K01

    how can i do that
  • adamalton
    New Member
    • Feb 2007
    • 93

    #2
    You need to explain this better!

    Comment

    • matthooper
      New Member
      • May 2007
      • 37

      #3
      I think what your getting at is when you're on the second page you are using the ID and you want to get the name,

      What you need to do on the second page is another query:

      $sql = "select * from table where id = ". $_GET['id'];

      and from that get the information you need to display!

      Comment

      • pbmods
        Recognized Expert Expert
        • Apr 2007
        • 5821

        #4
        Originally posted by matthooper
        [PHP]$sql = "select * from table where id = ". $_GET['id'];[/PHP]
        Should be:

        [PHP]$sql = "select * from table where id = ". addslashes($_GE T['id']);[/PHP]

        to prevent an SQL injection attack.

        Comment

        Working...