将数据上传到数据库时出现问题

问题描述:

我在将数据发送到数据库时遇到问题.问题是每次我刷新页面时,它都会自动发送以前的数据.谁能帮忙.

I am facing problem in sending data to database. The problem is every time i refresh the page it automatically send the previous data. Can any one help.

if (isset($_POST['Posts'])) {
    if (isset($_POST['t']) && isset($_POST['i']) && isset($_POST['P'])) {
        $title = $_POST['t'];
        $idea = $_POST['i'];

        if (!empty($title) && !empty($idea)) {
            $query = "INSERT INTO `updates` VALUES ('".mysql_real_escape_string($title)."')";
            if ($query_run = mysql_query($query)) { } 
            else {
                echo 'Sorry ,we could\'t register you at this time.Try again later';
            } 
        }                    
    }
}

在db中插入后清除帖子数据. 在插入db代码后添加以下代码.

Clear your post data after insert in db. Add below code after insertion db code.

$_POST = array();

就像在if块中一样

... 
 if ($query_run = mysql_query($query)) { $_POST = array(); } 
...