just type required in your tag example: <input type="password" placeholder="Password" class="validate" required>
if ((empty($value) && $value != 0) && in_array($key, $required_fields) === true) {