php-html问题,当使用不输入必填字段时,从函数返回false值

php-html issue with returning a false value from function when uses doesn't enter required fields. I have 4-5 required fields and if a user doesn't enter in one field and tries to push data to the database it should throw error but I'm not getting a false value returned I messed with my function and have tried returning a Boolean value but doesn't work.

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
  include_once 'includes/functions.php';

class board_build 
{
    const db_host = 'localhost';
    const db_user = 'root';
    const db_pass = '*******';
    const db_name = 'abes_rocking_db';
    public $conn = null;

    /*Open the database connection*/
    public function __construct()
    {
        // open database connection
        $connectionString = sprintf("mysql:host=%s;dbname=%s",
                board_build::db_host,
                board_build::db_name);
        try 
        {
            $this->conn = new PDO($connectionString,
            board_build::db_user,
            board_build::db_pass);
        }
        catch (PDOException $pe) 
        {
            die($pe->getMessage());
        }
    }//end of constructor

    /*Insert a row into a table @return returns a PDOStatement object, or false on failure.*/
    public function insert_board($board_part_number, $revision_number, $batch_number,
                                $work_order, $serial_number_low, 
                                $serial_number_high, $serial_number, $serial_count, 
                                $notes, $parts_pnp, $solder_paste,
                                $solder_paste_type, $stencil_number, $wiper_pressure,
                                $stencil_wiper_setup_verified_by, $stencil_wiper_setup_verified_date,
                                $pnp_file_verified_by, $pnp_file_verified_date, $pnp_parts_verified_by,
                                $pnp_parts_verified_date, $oven_conveyor_speed, $oven_chamber_one_temp,
                                $oven_chamber_two_temp, $oven_chamber_three_temp, $oven_chamber_four_temp,
                                $oven_verified_by, $oven_verified_date, $inspect_first_board_stencil,
                                $inspect_first_board_pnp, $inspect_first_board_oven, $built_by, $built_date,
                                $inspected_by, $inspected_date, $data_entered_by)
    {
    $data = array(
            'board_part_number'                     => filter_input(INPUT_POST,'board_part_number'),
            'revision_number'                       => filter_input(INPUT_POST,'revision_number'),
            'batch_number'                          => filter_input(INPUT_POST,'batch_number'),
            'work_order'                            => filter_input(INPUT_POST,'work_order'),
            'serial_number_low'                     => filter_input(INPUT_POST,'serial_number_low'),
            'serial_number_high'                    => filter_input(INPUT_POST,'serial_number_high'),
            //'serial_number'                         => filter_input(INPUT_POST,'serial_number'),
            //'serial_count'                          => filter_input(INPUT_POST,'serial_count'),
            'notes'                                 => filter_input(INPUT_POST,'notes'),
            'parts_pnp'                             => filter_input(INPUT_POST,'parts_pnp'),
            'solder_paste'                          => filter_input(INPUT_POST,'solder_paste'),
            'solder_paste_type'                     => filter_input(INPUT_POST,'solder_paste_type'),
            'stencil_number'                        => filter_input(INPUT_POST,'stencil_number'),
            'wiper_pressure'                        => filter_input(INPUT_POST,'wiper_pressure'),
            'stencil_wiper_setup_verified_by'       => filter_input(INPUT_POST,'stencil_wiper_setup_verified_by'),
            'stencil_wiper_setup_verified_date'     => filter_input(INPUT_POST,'stencil_wiper_setup_verified_date'),
            'pnp_file_verified_by'                  => filter_input(INPUT_POST,'pnp_file_verified_by'),
            'pnp_file_verified_date'                => filter_input(INPUT_POST,'pnp_file_verified_date'),
            'pnp_parts_verified_by'                 => filter_input(INPUT_POST,'pnp_parts_verified_by'),
            'pnp_parts_verified_date'               => filter_input(INPUT_POST,'pnp_parts_verified_date'),
            'oven_conveyor_speed'                   => filter_input(INPUT_POST,'oven_conveyor_speed'),
            'oven_chamber_one_temp'                 => filter_input(INPUT_POST,'oven_chamber_one_temp'),
            'oven_chamber_two_temp'                 => filter_input(INPUT_POST,'oven_chamber_two_temp'),
            'oven_chamber_three_temp'               => filter_input(INPUT_POST,'oven_chamber_three_temp'),
            'oven_chamber_four_temp'                => filter_input(INPUT_POST,'oven_chamber_four_temp'),
            'oven_verified_by'                      => filter_input(INPUT_POST,'oven_verified_by'),
            'oven_verified_date'                    => filter_input(INPUT_POST,'oven_verified_date'),
            'inspect_first_board_stencil'           => filter_input(INPUT_POST,'inspect_first_board_stencil'),
            'inspect_first_board_pnp'               => filter_input(INPUT_POST,'inspect_first_board_pnp'),
            'inspect_first_board_oven'              => filter_input(INPUT_POST,'inspect_first_board_oven'),
            'built_by'                              => filter_input(INPUT_POST,'built_by'),
            'built_date'                            => filter_input(INPUT_POST,'built_date'),
            'inspected_by'                          => filter_input(INPUT_POST,'inspected_by'),
            'inspected_date'                        => filter_input(INPUT_POST,'inspected_date'),
            'data_entered_by'                       => $_SESSION['username']);

        $sql = 'INSERT INTO abes_table(board_part_number, revision_number, batch_number,
                          work_order, serial_number_low, serial_number_high, serial_number, 
                          serial_count, notes, parts_pnp, solder_paste,
                          solder_paste_type, stencil_number, wiper_pressure,
                          stencil_wiper_setup_verified_by, stencil_wiper_setup_verified_date,
                          pnp_file_verified_by, pnp_file_verified_date, pnp_parts_verified_by,
                          pnp_parts_verified_date, oven_conveyor_speed, oven_chamber_one_temp,
                          oven_chamber_two_temp, oven_chamber_three_temp,
                          oven_chamber_four_temp, oven_verified_by, oven_verified_date,
                          inspect_first_board_stencil, inspect_first_board_pnp,
                          inspect_first_board_oven, built_by, built_date, inspected_by, inspected_date, data_entered_by)
                   VALUES(:board_part_number, :revision_number, :batch_number,
                          :work_order, :serial_number_low, :serial_number_high, :serial_number, :serial_count, 
                          :notes, :parts_pnp, :solder_paste, :solder_paste_type, :stencil_number,
                          :wiper_pressure, :stencil_wiper_setup_verified_by, :stencil_wiper_setup_verified_date,
                          :pnp_file_verified_by, :pnp_file_verified_date, :pnp_parts_verified_by,
                          :pnp_parts_verified_date, :oven_conveyor_speed, :oven_chamber_one_temp,
                          :oven_chamber_two_temp, :oven_chamber_three_temp, :oven_chamber_four_temp,
                          :oven_verified_by, :oven_verified_date, :inspect_first_board_stencil,
                          :inspect_first_board_pnp, :inspect_first_board_oven,
                          :built_by, :built_date, :inspected_by, :inspected_date, :data_entered_by)';

      // set 'serial_count' as the numbered amount contained from serial_number_low to serial_number_high       
      $data['serial_count'] = ($data['serial_number_high'] - $data['serial_number_low']) + 1;

      // initialize 'serial_number' to 'serial_number_low' value
      $data['serial_number'] = $data['serial_number_low'];

      if($data['serial_number_low'] == $data['serial_number_high'])
      {
          $q = $this->conn->prepare($sql);
          return $q->execute($data);
          mysqli_close($conn);
      }
      else
      {
      // iterate from 'serial_number_low' to 'serial_number_high'
      // and complete database actions/tasks
      for($i = $data['serial_number_low']; $i < $data['serial_number_high']; $i++) 
      {
          $q = $this->conn->prepare($sql);
          $q->execute($data);
          // increment 'serial_number' after the first execution and continue to
          // increment for each iteration done
          $data['serial_number']++;

          // '$data' must be valid for a successful added task
          // verification is done on the last execution of the last row of data
          // to be passed into the database
          if($i == ($data['serial_number_high'] - 1)) 
          {
              return $q->execute($data);
              mysqli_close($conn);
          }
        }
      } 
    }
}

***/* Error catching (from the form php file*/***
<?php
   if(isset($_POST['add']))
   {
        $obj = new board_build;
    if($obj->insert_board($data) != false)
      echo 'A new task has been added successfully';
    else
      echo 'Error adding the task';
    }
    else
    {
 ?>