if (isset($_POST['submit'])) { print_r($_POST); foreach ($_POST as $key => $value) { if (empty($_POST[$key])) { $error = 'Fill empty fields first.'; } else { $data[$key] = $value; } } if (!isset($error)) { $obj = new inject_record(); $add_result = $obj->add_area(); } } $obj = new inject_record(); $uc_result = $obj->get_uc(); $result = $obj->get_area(null); //print_r($result); ?> <!DOCTYPE html> <!-- To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>Add Area</title> <?php require 'inc/head.php'; ?>