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

<?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>"; 
    }
}

?>
posted @ 2012-06-29 17:48  神马和浮云  阅读(1262)  评论(1编辑  收藏  举报