-1

dbからレコードを取得して、テーブルに入れようとしています。処理できる更新ボタンが欲しいのですが。これがコードです。正しく出力します。ただし、更新ボタン(画像)は機能しません。助けてください

<?php
echo "</br>";
echo "<table border='1'>
<tr>
<th>Order ID</th>
<th>Customer Number</th>
<th>Order Items</th>
<th>Transaction Time</th>
<th>Amount</th>
</tr>";
$con = mysql_connect('localhost', 'root', '');
if (!$con)
  {
  die('Could not connect: ' . mysql_error());
  }

mysql_select_db("kaka", $con);

$sql="SELECT * FROM orders WHERE status = 'NRDY'";
$result2 = mysql_query($sql);
while($row1 = mysql_fetch_array($result2))
  {
  echo "<div class=\"update\"><form method='post' action=\"test.php\">\n";  
  echo "<tr>";
  echo "<td><input type='hidden' name='order_id' value='".$row1['order_id']."'>" .$row1['order_id']. "</td>";
  echo "<td><input type='hidden' name='cust_num' value='".$row1['cust_num']."'>" .$row1['cust_num']. "</td>";
  echo "<td><input type='hidden' name='items' value='".$row1['items']."'>" .$row1['items']. "</td>";
  echo "<td><input type='hidden' name='order_time' value='".$row1['order_time']."'>" .$row1['order_time']. "</td>";
  echo "<td><input type='hidden' name='order_id' value='".$row1['amount']."'>" .$row1['amount']. "</td>";
  //echo "<td>" . $row1['order_id'] . "</td>";
  //echo "<td>" . $row1['cust_num'] . "</td>";
  //echo "<td>" . $row1['items'] . "</td>";
  //echo "<td>" . $row1['order_time'] . "</td>";
  //echo "<td>" . $row1['amount'] . "</td>";
  echo "<td>" . "<input type=\"image\" src=\"images/update.png\" alt=\"Update Row\" class=\"update\" title=\"Update Row\">\n" . "</td>";
  echo "</tr>";
  echo "</form></div>";  
  }

 echo "</table>";
?>

これがtest.phpです

<?php
echo $_POST['order_id'];
?>
4

1 に答える 1

1

バリデーターを使用します。テーブルの行の周りにdivまたはフォームをラップすることは許可されていません。一部のブラウザは、div / formをテーブルの外に移動する(コンテンツを残して)ことにより、このエラーから回復します。したがって、入力はフォーム内にないため、何もすることを期待しないでください。

于 2012-09-21T06:27:32.980 に答える