PHP标头重定向到Wordpress页面

时间:2015-04-18 10:57:41

标签: php wordpress redirect header

我想在不同页面上重定向我的验证消息,但它只是重定向到成功页面,但数据库保持不变。

其他条件是问题

<?php
if(isset($_POST['submit'])) {
    $fullname = $_POST['fullname'];
    $age = $_POST['age'];
    $email = $_POST['email'];

    $dbc = mysqli_connect('localhost','root','root','wordpress'); 

    if(!empty($fullname) && !empty($age) && !empty($email)) {
        $query = "SELECT * FROM wp_mypage WHERE email='$email'";
        $result = mysqli_query($dbc, $query);
        $data = mysqli_fetch_arrray($result);
        if(mysqli_num_rows($data) == 0) {
            $query = "INSERT INTO wp_mypage (name, age, email) 
                      VALUES  ('$fullname', '$age', '$email')";
            mysqli_query($dbc, $query);
            header("Location: http://localhost/wordpress/?page_id=67"); 
        } else {
            header("Location: http://localhost/wordpress/?page_id=73"); 
        }
    } else {
        header("Location: http://localhost/wordpress/?page_id=73");
    }
    mysqli_close($dbc);
}
?>

0 个答案:

没有答案