The code works as it is but it's very messy. Is there a way to clean up the null checking in the if statement?
public function submitCoil ($data) {
$db = Database::getInstance();
//Define certain query values
$uniqueID = $this->hash("id");
$queryData = array(
'fields' => array(
'uniqueid',
'uploaded',
'name',
'resistance',
'wrapped',
'category',
'description',
'wraps',
'images',
'wire_one',
'wire_two',
'wire_three',
'wire_four',
'wire_five',
'wire_six'
),
'values' => array(
'uniqueID' => $uniqueID,
'uploaded' => date("F j, Y", time()),
'name' => $data['name'],
'resistance' => $data['resistance'],
'wrapped' => $data['wrapped'],
'category' => $data['category'],
'description' => $data['description'],
'wraps' => $data['wraps'],
'images' => "coils/" . $uniqueID . "/",
'wire_one' => $data['wire_one'],
'wire_two' => $data['wire_two'],
'wire_three' => $data['wire_three'],
'wire_four' => $data['wire_four'],
'wire_five' => $data['wire_five'],
'wire_six' => $data['wire_six']
)
);
//Make sure mandatory datas are filled out
if (!empty($queryData['values']['name']) && !empty($queryData['values']['resistance']) && !empty($queryData['values']['wrapped']) && !empty($queryData['values']['description']) && !empty($queryData['values']['wraps'])) {
$db->insertFew("coils", $queryData['fields'], $queryData['values']);
} else {
echo "Please fill all fields";
}