Validate user input.
Garbage in results in garbage out. When designing an application that accepts data from the user, you must ensure that the entered data is acceptable for the application. The most relevant place to ensure the validity of data is at the time of data entry itself. You can use various techniques for validating data:
You can restrict the values that a field can accept by using standard controls such as combo boxes, list boxes, radio buttons, and check boxes. These allow users to select from a set of given values rather than permit free keyboard entry.
You can capture the user's keystrokes and analyze them for validity. Some fields may require the user to enter only alphabetic values but no numeric values ...