Question: Every time I try to submit the form and I have not entered nothing in the year field I get `Incorrect year!` how can I still submit the form without having to enter a year. In other words leaving the year field blank and not getting a warning?

Here is the PHP code.

```
if(preg_match('/^\d{4,}$/', $_POST['year'])) {
    $year = mysqli_real_escape_string($mysqli, $_POST['year']);
} else {
    $year = NULL;
}

if($year == NULL) {
    echo '<p class="error">Incorrect year!</p>';
} else {
    //do something
}

```

Answer: 
```
if(preg_match('/^\d{4,}$/', $_POST['year'])) {
    $year = mysqli_real_escape_string($mysqli, $_POST['year']);
} else {
    $year = false;
}

if ($year === false) {
    echo '<p class="error">Incorrect year!</p>';
} else {
    //do something
}

```

OR (if you didn't set YEAR somewhere else)

```
if(preg_match('/^\d{4,}$/', $_POST['year'])) {
    $year = mysqli_real_escape_string($mysqli, $_POST['year']);
}

if (!isset($year)) {
     echo '<p class="error">Incorrect year!</p>';
} else {
    //do something
}

```
```
if(preg_match('/^\d{4,}$/', $_POST['year'])) {
    $year = mysqli_real_escape_string($mysqli, $_POST['year']);
} else if(empty($_POST['year'])){
    $year = '';
} else {
    $year = null;
} 

if($year == NULL) {
    echo '<p class="error">Incorrect year!</p>';
} else {
    //do something
}

```

Perhaps I'm misunderstanding, but this sounds like what you want.