Php 每行mysql数据上的超链接

Php 每行mysql数据上的超链接,php,mysql,Php,Mysql,您需要传递url中的id,如果有,您需要读取它 e、 g 您需要传递url中的id,如果有,您需要读取它 e、 g 好建议,+1给你:)好建议,+1给你:) <?php require 'database.php'; $query = "SELECT id, date, ponumber FROM so"; $result = $mysqli->query($query) or die(mysqli_error($mysqli)); if ($result) { echo

您需要传递url中的id,如果有,您需要读取它

e、 g


您需要传递url中的id,如果有,您需要读取它

e、 g


好建议,+1给你:)好建议,+1给你:)
<?php

require 'database.php'; 
$query = "SELECT id, date, ponumber FROM so";

$result = $mysqli->query($query) or die(mysqli_error($mysqli));

if ($result) {
  echo "<form method='post' action='delete.php'>"; 

  echo "<table cellspacing='0' cellpadding='15' border='1'>
  <th >DELETE</th>
  <th >VIEW</th>
  <th >ID</th>
  <th >DATE</th>
  <th >PO NUMBER</th>";

  while ($row = $result->fetch_object()) {

$date      = $row->date ;
$ponumber  = $row->ponumber;
$id        = $row->id;
//put each record into a new table row with a checkbox
echo "<tr>
    <td>
        <input type='checkbox' name='checkbox[]' id='checkbox[]'  value=$id />
    </td>
     <td>
        $id
     </td>
     <td>
        <a href="view.php">view</a>
     </td>
    <td>
         $date
    </td>
<td>
       $ponumber
     </td>
  </tr>"; 
    }

   echo "</table><p><input id='delete' type='submit' class='button' name='delete' 

       value='Delete Selected Items'/></p></form>";}
?>
<?php
require 'database.php'; 
$query = "SELECT id, date, ponumber FROM so";
/* Edit 1 */
if (!empty($_GET['id'])) { 
    $query .= " WHERE id = " . mysql_real_escape_string($_GET['id']);
}
/* Edit 1 end */
$result = $mysqli->query($query) or die(mysqli_error($mysqli));
if($result) {
    echo "<form method='post' action='delete.php'>"; 
    echo "<table cellspacing='0' cellpadding='15' border='1'>
            <th >DELETE</th><th >VIEW</th><th >ID</th><th >DATE</th><th >PO NUMBER</th>";
    while ($row = $result->fetch_object()) {
        $date = $row->date ;
        $ponumber = $row->ponumber;
        $id = $row->id;
        //put each record into a new table row with a checkbox
        echo "<tr>
                  <td><input type='checkbox' name='checkbox[]' id='checkbox[]'  value=$id /></td>
                  <td>$id</td>
                  <td>";
            /* Edit 2 */
            echo "<a href='view.php?id=$id'>view</a>";
            /* Edit 2 End */
            echo "</td>
                  <td>$date</td>
                  <td>$ponumber</td></tr>"; 
    }
    echo "</table><p><input id='delete' type='submit' class='button' name='delete' value='Delete Selected Items'/></p></form>";}
?>
echo "<form method='post' action='delete.php'>"; 
echo ...
while
?>
<form method='post' action='delete.php'>
...
<?php
while