帮我用php+mysql编写一个用车申请网页包括用车申请、用车批准功能以及后台人员管理维护
以下是一个简单的用车申请网页的示例,包括用车申请、用车批准功能和后台人员管理维护:
前台页面:
- 用车申请表单
<form action="process_application.php" method="post">
<label for="name">姓名:</label>
<input type="text" id="name" name="name" required><br>
<label for="department">部门:</label>
<input type="text" id="department" name="department" required><br>
<label for="reason">用车事由:</label>
<textarea id="reason" name="reason" required></textarea><br>
<label for="date">用车日期:</label>
<input type="date" id="date" name="date" required><br>
<label for="time">用车时间:</label>
<input type="time" id="time" name="time" required><br>
<label for="destination">目的地:</label>
<input type="text" id="destination" name="destination" required><br>
<button type="submit">提交申请</button>
</form>
- 用车申请列表
<table>
<tr>
<th>姓名</th>
<th>部门</th>
<th>用车事由</th>
<th>用车日期</th>
<th>用车时间</th>
<th>目的地</th>
<th>状态</th>
</tr>
<?php
// 获取用车申请列表
$sql = "SELECT * FROM applications";
$result = mysqli_query($conn, $sql);
// 遍历申请列表
while ($row = mysqli_fetch_assoc($result)) {
echo '<tr>';
echo '<td>' . $row['name'] . '</td>';
echo '<td>' . $row['department'] . '</td>';
echo '<td>' . $row['reason'] . '</td>';
echo '<td>' . $row['date'] . '</td>';
echo '<td>' . $row['time'] . '</td>';
echo '<td>' . $row['destination'] . '</td>';
echo '<td>' . $row['status'] . '</td>';
echo '</tr>';
}
?>
</table>
- 用车批准表单
<form action="process_approval.php" method="post">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<label for="driver">司机姓名:</label>
<input type="text" id="driver" name="driver" required><br>
<label for="car">车牌号码:</label>
<input type="text" id="car" name="car" required><br>
<button type="submit">批准</button>
</form>
后台页面:
- 人员管理列表
<table>
<tr>
<th>姓名</th>
<th>部门</th>
<th>职位</th>
<th>操作</th>
</tr>
<?php
// 获取人员列表
$sql = "SELECT * FROM users";
$result = mysqli_query($conn, $sql);
// 遍历人员列表
while ($row = mysqli_fetch_assoc($result)) {
echo '<tr>';
echo '<td>' . $row['name'] . '</td>';
echo '<td>' . $row['department'] . '</td>';
echo '<td>' . $row['position'] . '</td>';
echo '<td><a href="edit_user.php?id=' . $row['id'] . '">编辑</a> | <a href="delete_user.php?id=' . $row['id'] . '">删除</a></td>';
echo '</tr>';
}
?>
</table>
- 添加人员表单
<form action="process_add_user.php" method="post">
<label for="name">姓名:</label>
<input type="text" id="name" name="name" required><br>
<label for="department">部门:</label>
<input type="text" id="department" name="department" required><br>
<label for="position">职位:</label>
<input type="text" id="position" name="position" required><br>
<button type="submit">添加人员</button>
</form>
- 编辑人员表单
<form action="process_edit_user.php" method="post">
<input type="hidden" name="id" value="<?php echo $id; ?>">
<label for="name">姓名:</label>
<input type="text" id="name" name="name" value="<?php echo $name; ?>" required><br>
<label for="department">部门:</label>
<input type="text" id="department" name="department" value="<?php echo $department; ?>" required><br>
<label for="position">职位:</label>
<input type="text" id="position" name="position" value="<?php echo $position; ?>" required><br>
<button type="submit">保存更改</button>
</form>
以上代码只是示例,实际应用中还需要进行更多的安全性检查和错误处理。
原文地址: https://www.cveoy.top/t/topic/bibc 著作权归作者所有。请勿转载和采集!