input validation both at front end and back end