【发布时间】: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 重定向工作,但语法的插入是双重的
【问题讨论】: