SQL查询无法在PHP中工作,没有数据插入数据库

I'm making a page where user can input their infos and it'll be added to the database I have set up.

profile.php

<?php

    $user_id = filter_input(INPUT_POST, 'user_id', FILTER_VALIDATE_INT);
    $name = filter_input(INPUT_POST, 'name');
    $age = filter_input(INPUT_POST, 'age', FILTER_VALIDATE_INT);
    $weight = filter_input(INPUT_POST, 'weight', FILTER_VALIDATE_FLOAT);
    $height = filter_input(INPUT_POST, 'height', FILTER_VALIDATE_FLOAT);
    $goal_id = filter_input(INPUT_POST, 'goal_id', FILTER_VALIDATE_INT);

    //Validate INPUT_POST
    if ($user_id == null || $name == null || $age == null || $weight == null || $height == null || $goal_id == null || $goal_id == false) {
        $error = "Invalid user data. Check all fields and try again.";
        //include('../Error/error.php');
    } else {
        require_once('Model/database.php');

        //Add user information
        $query = 'INSERT INTO user
                  (userID, userName, userAge, userWeight, userHeight, userGoalID)
                  values
                  (:user_id, :name, :age, :weight, :height, :goal_id)';


        $statement = $db->prepare($query);
        $statement->bindValue(':user_id', $user_id);
        $statement->bindValue(':name', $name);
        $statement->bindValue(':age', $age);
        $statement->bindValue(':weight', $weight);
        $statement->bindValue(':height', $height);
        $statement->bindValue(':goal_id', $goal_id);
        $statement->execute();
        $statement->closeCursor();

        // Display the Product List page
        include('index.php');
}
?>

add_profile.php (main page)

<?php
require('Model/database.php');
$query = 'SELECT *
          FROM goal
          ORDER BY userGoalID';

$statement = $db->prepare($query);
$statement->execute();
$categories = $statement->fetchAll();
$statement->closeCursor();
?>
<!DOCTYPE html>
<html>

<!-- the head section -->
<head>
    <title>Fitness</title>
</head>

<!-- the body section -->
<body>
    <header><h1 id="addProducth1">User Profile</h1></header>

    <main>

        <h1></h1>
        <form action="profile.php" method="post"
              id="add_product_form">

            <label>Goal:</label>
            <select name="goal_id">
            <?php foreach ($categories as $goal_id) : ?>
                <option value="<?php echo $goal_id['userGoalID']; ?>">
                    <?php echo $goal_id['userGoalType']; ?>
                </option>
            <?php endforeach; ?>
            </select><br>

            <label id="label1">ID:</label>
            <input type="text" name="user_id"><br>

            <label id="label1">Name:</label>
            <input type="text" name="name"><br>

            <label id="label2">Age:</label>
            <input type="text" name="age"><br>

            <label id="label3">Weight:</label>
            <input type="text" name="weight"><br>

            <label id="label3">Height:</label>
            <input type="text" name="height"><br>

            <label>&nbsp;</label>
            <input id="addProduct3" type="submit" value="Add User"><br>
        </form>
    </main>

</body>
</html>

The page is working fine I guess, no error is shown or catched, but the information supplied by the user is not recorded in the table and i'm not exactly sure why.