PHP validation and database insertion work