弹出确认框,提示是否留言成功

<?php
include_once 'common.php';
include 'conn.php';

$sql_add="insert into `message` (`id`,`user`,`title`,`content`,`lastdate`) values ('','$_POST[user]','$_POST[title]','$_POST[content]',now())";
if ($_POST[submit]){
    mysql_query($sql_add);
    if (mysql_affected_rows()<1){
        echo "<script> {window.alert('留言发布失败,请从新留言或与管理员联系');location.href= 'add.html'} </script>";
    }
    else {
     echo "<script> if(confirm( '留言发布成功,是否返回留言页? ')) location.href='add.html';else location.href='list.html'; </script>"; 
    }
}

?>
原文地址:https://www.cnblogs.com/xcxc/p/2570300.html