Added conditions to change settings

Feilds cannot be empty or invalid. If so, the db will not be updated