When you work with forms and databases a lot you will often want to save the numerical value of a form element, in particular a group of radio buttons, to a database. In general this is easy, however if the field is not mandatory and the user chooses not to answer then the value which gets passed is null, or a blank string. If you pass the cInt function a null value, blank string, or non-numerical string it raises an exception.
Whilst that in itself isn’t a problem as you can write a routine to check the value before using cInt and make sure it is a valid number, it is easier simply to adapt the cInt function to handle them. |