0

I have a php page that allows the user to input some data, and tries to put them into a database. However, my header is not working. It runs the query, but stops at the header, and displays a blank page. Can someone help me out?

<?php   
if(isset($_POST['submit'])) {
    $user_id = $_POST['user_id'];
    $user_vcode = $_POST['user_vcode'];
    $send_data = true;

    if(empty($user_id) || empty($user_vcode)){
        $send_data = false;
    }

    if($send_data){
        require("../../db.php");
        $account_id = $_COOKIE['account_id'];
        $query = "INSERT INTO api (key_id, key_vcode, owner_id) VALUES ('$user_id', '$user_vcode', '$account_id')";
        $result = mysqli_query($dbc, $query) or die("Failed querying database");
        mysqli_close($dbc);
        header("Location: http://www.google.com");
        die();
    }
}
?>
Taz
  • 3,718
  • 2
  • 37
  • 59
requinard
  • 921
  • 1
  • 11
  • 24

1 Answers1

1

Whitespace at the end of the file can be a big pain. Check for any trailing carriage returns or spaces after the final ?> tag.

Rob Forrest
  • 7,329
  • 7
  • 52
  • 69