How to get the value on the next page from anchor tag.?

时间:2017-04-06 16:55:55

标签: php

I need to show particular persons info on the next page info.php by clicking the name which is inside the anchor tag. So how can i pass the value of id of that person on the next page and retrieve data from it.

<tr>
    <?php 
        while($row = mysqli_fetch_assoc($result)){

            echo '<tr>';
            echo '<td>'.$row['id'].'</td>';
            echo '<td><a href="">'.$row['name'].'</a></td>';
            echo '<td>'.$row['username'].'</td>';
            echo '<td>'.$row['password'].'</td>';

            echo '</tr>';
        }
    ?>
</tr>

3 个答案:

答案 0 :(得分:0)

Pass:

echo "<td><a href='info.php?id={$row['id']}'>" . $row['name'] . '</a></td>';

Get:

mysqli_real_escape_string($_GET['id'])

答案 1 :(得分:0)

代码在这里:

    while ($row = mysqli_fetch_array($result)) {
     echo "<a href='edit-main-con.php?edit=$row[id]'>Done</a><br>";
    }

答案 2 :(得分:-1)

获取通过锚标记传递的值。 id 是包含ID:

的名称
$X=$_GET['ID'];
echo $X;