html - 点击提交按钮需要关闭模态窗口
问题描述
一旦我点击提交按钮页面被刷新,模式窗口没有被关闭。点击提交按钮后需要关闭窗口。这是我尝试过的代码。
<div id="id01" class="modal">
<span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
<form class="modal-content" action="contactus.php" method="post" role="form" enctype="multipart/form-data">
<div class="container">
<label for="name"><b>Name</b></label>
<input type="text" placeholder="Enter Your Name" name="uname" id="uname" required>
<label for="companyname"><b>Company Name</b></label>
<input type="text" placeholder="Enter Company Name" name="companyname" id="companyname" required>
<label for="phonenumber"><b>Phone Number</b></label>
<input type="text" placeholder="Enter Phone Number" name="phonenumber" id="phonenumber" required>
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" id="email" required>
<label for="countries"><b>Country</b></label>
<script src="js/countries.js"></script>
<select id="country2" name ="country2" ></select>
<div class="clearfix">
<button id="submit_contact" name="submit_contact" type="submit" class="signupbtn">Submit</button>
</div>
</div>
</form>
</div>
联系我们:
<?php
if(isset($_POST['submit_contact'])) {
if(!$mail->send()) {
$msg = "Error while sending email";
$msgclass = 'bg-danger';
} else {
$msg = 'A mail with recovery instruction has sent to your email.';
$msgclass = 'bg-success';
}
} ?>
解决方案
推荐阅读
- python - 如何获得与输入具有相同维度的 CNN 的输出
- javascript - 消除
- yajra-datatable - 在前端如何在 td yajra dataTable 中设置属性或添加类
- android-studio - FrameEvents:updateAcquireFence:没有找到框架
- computer-vision - 智能手机相机运动估计 - 检测退化情况
- validation - 限制用户在更新和保存另一个依赖字段之前更新一个字段
- python - PHP:调用 python 脚本会引发 ModuleNotFoundError,从终端调用是否正常?
- c++ - 错误:助记符中的字符“(”无效
- multithreading - 使用条件变量的死锁
- typescript - 带有一般错误的打字稿缩小类型