255) { $cupboard_name_err = "Max size for the cupboard name is 255 characters. " . "Yours was " . strlen(trim($_POST["name"])) . " characters long."; } else { $cupboard_name = trim($_POST["name"]); } // DESCRIPTION if (empty(trim($_POST["description"]))) { $cupboard_description = null; } else if (strlen(trim($_POST["description"])) > 65535) { $cupboard_description_err = "Your description is too long."; } else { $cupboard_description = trim($_POST["description"]); } // ======================================================================== // ======================================================================== // INSERTION IN DATABASE IF CORRECT // ======================================================================== if (empty($cupboard_name_err) && empty($cupboard_description_err)) { if (!add_cupboard($cupboard_name, $cupboard_description)) { echo "Oops! Something went wrong. Please try again later."; } } else { echo $cupboard_name_err; echo $cupboard_description_err; } exit(); } ?>