【问题标题】:display pop up div html before redirect to another page在重定向到另一个页面之前显示弹出 div html
【发布时间】:2019-01-22 07:39:53
【问题描述】:

我在插入语法后使用重定向来防止 php 中的双重插入

这是我的 php 代码:

if (mysqli_num_rows($result_email) > 0)
{
    $emailerror = true; //display pop up working properly
}
else 
{
      //insert sql syntax 
      $emailerror = false;
      header('Location: index.php');
}

insert sql 语法有效,但是当刷新页面时,插入会加倍,这就是我添加标题位置以防止它的原因。 但我想在注册后显示弹出注册成功并重定向到另一个页面

这是我的简短 html 代码:

<?php
if ($emailerror == true)
{
    echo "<div class='popup_email_error'> </div>";
}
else if($emailerror == false)
{
     echo "<div class='popup_register'> </div>";
}
?> // this code is working properly without header location syntax but the problem is the insertion sql is always doubled

我想在重定向到另一个页面之前先弹出,反之亦然 如何防止没有标题位置的双重插入

我已经尝试过 javascript 重定向工作,但语法的插入是双重的

【问题讨论】:

    标签: php html


    【解决方案1】:

    您可以使用flash 包将它们发送到您的视图。每次调用(包括重定向),它将存储在您的 $_SESSION 变量中。

    【讨论】:

      猜你喜欢
      • 2014-12-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-06
      • 1970-01-01
      • 2015-12-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多