#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2013
    Posts
    16
    Rep Power
    0

    Show data with link


    Dear Experts,

    I have following codes

    PHP Code:
    $sql "SELECT * from contacts order by name" ;
    $select mysqli_query($con,$sql);
    $row=mysqli_num_rows($select);
    //echo ($row);
    while($row mysqli_fetch_array($select))
    {
        echo 
    "<tr>";
        echo 
    "<td> <a href='edit.php?id=".$row['id']."'>
        <img border=noborder src=images/pencil.png title=Display></a></td>"
    ;
        echo 
    "<td align='left'> " $row["name"].  "</td>";
        echo 
    "<td> " $row["moba"]. "</td>";
        echo 
    "<td> " $row["city"]. "</td>";
        echo 
    "<td> " $row["country"] . "</td>";
        echo 
    "</tr>";
    }
    ?>        </tbody>
           </table> 
    and Edit.php has this data

    PHP Code:
    <?php
        
    require_once("connect.php");
            
    $sno =$_GET['id']; 
            
    $query ="SELECT * FROM contacts WHERE id = $sno ";
            
    $result=mysqli_query($con$query);
            
            if (
    $result){
                
                      while (
    $row mysqli_fetch_array($result))
                      {
                   echo 
    $row['name']."<br>";
                      echo 
    $row['moba'];
                      }
                     }else{
                  echo 
    "no data found";
              }
    ?>
    I press a link then related data must appear in related textboxes against selected id like shown in image



    Please help
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    as long as you don't listen to us, this whole thing is pointless. Several people have told you that your code has massive security vulnerabilities. Now it's even worse, because you've added some cross-site scripting vulnerabilities. If you put this code online, the next best script kiddie will "hack" your server and your users (which is even worse) in a matter of minutes.

    This is what you need to fix first. As long as your code is fundamentally broken, we cannot have a discussion about fancy features.

    So are you willing to fix the problems? Or do you give a damn about what we have to say? In this case, I don't see how we could help you.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo