我的页面在刷新时重新提交数据

时间:2016-03-08 16:51:40

标签: php

$qry_str = "insert into ads values('','$ordid','$prdnm','$ordsku','$ordadd','$retadd')";
if($con->query($qry_str) === TRUE)
{
        /*header("Location:your another page link here?msg=New%record%added%successfully");*/
        echo "<script type='text/javascript'> alert('Inserted succcessfully'); </script>"; 
        unset($_POST['insert']);
}
else
{
        echo "Error:".$con->error;

}
mysqli_close($con);

1 个答案:

答案 0 :(得分:0)

尝试修改

    $qry_str = "insert into ads values('','$ordid','$prdnm','$ordsku','$ordadd','$retadd')"; 
    if($con->query($qry_str) === TRUE) { 
    header("Location: http://your-site.com/a.php?msg=New%record%added%successfully"); 
    echo "<script type='text/javascript'> alert('Inserted succcessfully'); </script>"; 
    unset($_POST['insert']); 
    mysqli_close($con);
    exit;
    }
    else {
    echo "Error:".$con->error;
    }
    mysqli_close($con);