我爲全新的編碼時,我的朋友建議我去學習PHP的,所以他給我的小項目,我應該嘗試,這是一個員工門戶。我陷入了一件事。一鍵獲取禁用其他按鈕被點擊
我需要一個接受拒絕按鈕在那裏當我點擊確認按鈕拒絕按鈕應被禁用,並在按鈕的值應該在數據庫中自動更新,反之亦然。還有一件事是,當我點擊拒絕按鈕評論框應彈出,輸入的值應加入到數據庫
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<?php
include'nav.php';
$servername = "127.0.0.1";
$username = "root";
$password = "";
$dbname = "";
$conn = new mysqli($servername, $username, $password, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql=mysqli_query($conn, "SELECT user, leavetype, date, date1, numb, comment FROM lms");
/*$result= $conn->query($sql);*/
if ($sql) {
if ($sql->num_rows > 1) {
echo "<table class='table table-hover'><tr><td>User</td><td>Leave type</td><td>From date</td><td>To date</td><td>Number of days</td><td>Reason for leave</td><td></tr>";
while($row=mysqli_fetch_array($sql))
{
echo "<tr><td id='rowhead'>$row[0]</td><td>$row[1]</td><td>$row[2]</td><td>$row[3]</td><td>$row[4]</td><td>$row[5]</td><td><button type='button' class='btn btn-success'>Approve</button> | <button type='button' class='btn btn-danger'>Rejected</button></td></tr>";
}
echo'</table>';
}
else {
echo "<br> No Record Found to display";
}
}
else {
echo "<br> Database error.";
}
$conn->close();
?>
</body>
</html>
你需要學習jQuery或JavaScript來解決你的問題,以上問題是不是一個PHP的問題..刪除PHP標籤 –
爲什麼MySQL是這裏標記? –
歡迎來到Stack Overflow !!!您需要嘗試您提供給我們的所有要求,然後如果您失敗了,請在此處提問。 –