我正在制作一个简单的 Php 和 javascript 项目,其中我的 css 设计中有一些覆盖设计。现在我有一个按钮,单击它会显示一个名为“myNav”的覆盖 div,其中有一个名为“req_form”的 div 和表单,用户可以在其中填写输入并提交它们,然后我的 php 代码将这些数据存储在我的数据库中。在我的 Php 代码中成功提交数据后,我只是不知道如何替换 div 并在其上显示成功。
<?php
include 'includes/autoloader.inc.php';
?>
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function openNav() {
document.getElementById("myNav").style.width="100%";
}
function closeNav(){
document.getElementById("myNav").style.width = "0";
}
</script>
<link rel="stylesheet" type="text/css" href="css/cssticket.css">
</head>
<body>
<button class="button_a" onclick="openNav()">Create Request</button> //OPENS THE OVERLAY DIV
<div id="myNav" class="overlay"> // THIS IS THE OVERLAY DIV
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<div class="overlay-content">
<div id="req_form" class="inputs"> // THIS IS THE DIV I WANT TO BE REPLACE BY A MESSAGE SUCCESS
<div id="error"></div>
<form id="form" action="includes/enduser.inc.php" method="POST">
<input type="text" name="userrequester" placeholder="name" >
<br>
<label for="reqtype">Request type:</label>
<select name="priority" required>
<option value="">Select</option>
<option value="High">General</option>
<option value="Low">Urgent</option>
</select>
<br>
<label for="itemtype">Item type:</label>
<input type="radio" name="typeitem" value="Borrowed" required><label>Borrowed</label>
<input type="radio" name="typeitem" value="Replace" required></input><label>Replace</label>
<br>
<label>Summary :</label>
<br>
<textarea name="summary" cols="30" rows="10" required ></textarea>
<br>
<button type="submit" name="sendrequest" class="button_a">Submit</button>
</div>
</form>
</div>
</div>
</body>
</html>
我已经尝试过的是在将数据存储在此 php 文件中之后回显一些应该将其更改为成功消息的 javascript。
喵喵时光机
摇曳的蔷薇
随时随地看视频慕课网APP