【发布时间】:2018-06-28 06:52:42
【问题描述】:
我有这个页面,员工离开可以由管理员批准/拒绝。到目前为止,这就是我所拥有的:
<body>
<?php
if(isset($_POST['approved']))
{
echo "Approved";
$status=$_POST['status'];
}
if(isset($_POST['rejected']))
{
echo "Rejected";
$status=$_POST['status'];
}
?>
<!-- Begin page content -->
<div class="container">
<div class="page-header">
<h3>
Employee Leaves
</h3>
<div class="table-responsive">
<table class="table">
<tr>
<th>Employee Name</th>
<th>Phone</th>
<th>Email</th>
<th>From</th>
<th>To</th>
<th>Reason</th>
<th>Status</th>
<th>---</th>
</tr>
<?php
include ('database.php');
$result = $database->prepare ("SELECT * FROM leaves order by id DESC");
$result ->execute();
for ($count=0; $row_message = $result ->fetch(); $count++){
?>
<tr>
<td><?php echo $row_message['full_name']; ?></td>
<td><?php echo $row_message['phone']; ?></td>
<td><?php echo $row_message['email']; ?></td>
<td><?php echo $row_message['fromdate']; ?></td>
<td><?php echo $row_message['todate']; ?></td>
<td><?php echo $row_message['reason']; ?></td>
<td><?php echo $row_message['status']; ?></td>
<td>
<form method="post" action=""><input type="submit" value="Approved" name="approved"></input></form>
 
<form method="post" action=""><input type="submit" value="Rejected" name="rejected"></input></form>
</td>
</tr>
<?php } ?>
</table>
<a href="home"><button type="button" class="btn btn-primary"><i class="glyphicon glyphicon-arrow-left"></i> Back</button></a>
</div>
</div>
</div>
</div>
所以当我点击批准/拒绝时,我试图让status 的值更新。
这是我的表架构:
我认为我最不需要的是更新查询(不确定)。我知道那里有很多教程,我很抱歉,但我就是无法理解。我想我需要一个特定的。
【问题讨论】:
-
运行此代码后出现的服务器端错误是什么?还是点击批准或拒绝按钮?
标签: php html sql database phpmyadmin