首页 > 解决方案 > 点击提交按钮需要关闭模态窗口

问题描述

一旦我点击提交按钮页面被刷新,模式窗口没有被关闭。点击提交按钮后需要关闭窗口。这是我尝试过的代码。

<div id="id01" class="modal">
  <span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">&times;</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';  
  }
} ?>

标签: htmltwitter-bootstrap

解决方案


推荐阅读