我有一個表,從mysql數據庫產生的用戶帳戶列表。我想要一個可以從這個列表中刪除用戶的按鈕。刪除用戶帳戶的按鈕
這裏是我的形式:
<td><form action="empdelete.php">
<?php echo "<input type='text' name='employee' value='".$employee['username']."'/><button type='submit' class='btn btn-default'>Delete</button>"?>
</form></td>;
這裏是我的empdelete.php:
<?php
if($_POST['submit'])
{
mysql_connect("host","username","pword") or die(mysql_error());
mysql_select_db("db") or die(mysql_error());
$username = $_POST['username'];
$result=mysql_query("DELETE FROM employee WHERE username='$username'") or die(mysql_error());
//confirm
echo "Employee Deleted";
}
?>
表名是員工和列名是用戶名。它似乎沒有工作..任何建議?
你沒有輸入軸承的'username' POST,你'employee' –
對不起 - 我在這個很新。你能爲我解釋多一點嗎? – sd0093
'