In order to ensure that the format and type of input data are correct, that data only contains allowed values, etc., it must be validated. Otherwise, you may run into issues when inserting it into a database. Validation also prevents security leaks caused by malicious user data.