How to have input validation with existing MySQL database