我有一个带有列表框的表单,该表单报告了MySql数据库中记录的一些id客户端。我选择了一个这个id客户端我点击一个名为selected-record
的按钮,我从数据库中获取数据,这些数据显示在php表中。这可以。然后我点击第二个名为delete-record
的按钮,目标是获取客户端的id - 变量$num_client
- 并运行sql delete指令删除记录。到目前为止我无法解决2分问题。
selected_record
会立即在表单上取消吗? delete_record
指令echo
num_client;`给出一个空值?
if ( isset($_POST['selected_record'])){
// visualiazzazione tabella
echo "<table border='1'>
<tr>
<th>Id cliente</th>
<th>Ragione Sociale</th>
<th>address</th>
<th>village</th>
<th>Provincia</th>
<th>Contatto</th>
<th>Dipartimento</th>
</tr>";
echo "<tr>";
echo "<td>" . $num_client. "</td>";
echo "<td>" . $rag_soc. "</td>";
echo "<td>" . $address. "</td>";
echo "<td>" . $village. "</td>";
echo "<td>" . $provincia. "</td>";
echo "<td>" . $contact_client. "</td>";
echo "<td>" . $dipart. "</td>";
echo "</tr>";
echo "</table>";
$result=mysqli_query($con,"SELECT id_cliente , ragione_sociale FROM clienti");
}
if( isset($_POST['delete_record'])) {
// Here If I make echo $num_client this gives no value ??
//$sql_del = "DELETE FROM `db_ordini_clienti`.`clienti` WHERE `id_cliente` = $num_client";
}