简体   繁体   English

提交后返回上一页并弹出模型

[英]After submit go back previous page with model pop up

I got a problem is after I save and go back to index.php .the model pop up not working, how to make after save, will get pup out model after going back to index.php. 我有一个问题是保存后返回index.php。模型弹出不起作用,保存后如何制作,回到index.php后会弹出模型。 Hope all pro can help me to solve this problem, tq. 希望所有的专业人士都能帮助我解决这个问题。 This one is index.php //This part is my model // 这是index.php //这是我的模型//

<form method="post" action="action.php">
<input type="text" name="username"/>
</form>
      <div class="modal fade" id="loginModal" role="dialog">
        <div class="modal-dialog">
          <div class="modal-content">
            <div class="modal-header">
              <button type="button" class="close" data-dismiss="modal">&times;</button>
              <div class="modal-title" style="padding-left: 18%;">
                <img style="width: 14%;" src="include/img/activation_page/logo.png">
                <img style="position: absolute; font-size: 20px;font-weight: 700; top: 15%; left: 30%;" src="include/img/memodise.png">
                <font style="font-size: 26px; font-weight: 300; position: absolute; top: 30%; left: 30%;">Log in</font>
                <font style="font-size: 12px; font-weight: 300; position: absolute; top: 60%; left: 30%;">Not a member? <span class="register1" id="register1">Register</span></font>
              </div>
            </div>
          </div>
        </div>
      </div>

//This one is my action.php// //这是我的action.php //

if(isset($_POST['login'])){
 //save data to database//

 echo "<script>window.location='index.php'</script>";
<script>$('#loginModal').modal('show')</script>
}
if(isset($_GET['return'])){

  echo "<script>$('#loginModal').modal('show')</script>";
}

Use the above snippet to show the model. 使用上面的代码片段显示模型。

in your action.php 在你的action.php

if(isset($_POST['login'])){
  //save data to database//

 echo "<script>window.location='index.php?return=1'</script>";
}

Hope this helps 希望这可以帮助

把它放在你的index.php中

<script>$('#loginModal').modal('show')</script>

Put this code in your action.php 将此代码放在您的action.php

<?php if(isset($_POST['login'])){ ?>
    <script>
        $('#loginModal').modal('show');
        $('#loginModal').on('hidden.bs.modal',function(){
            window.location = 'index.php';
        });
     </script>
<?php }?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM