in reply to form validation
yup, thanks guys for your suggestions.....
i was only checking for whitespaces not invalid characters so i used
<code>
if($FORM{'username'} =~ /\S/) { ..... }
this will check if $FORM{'username'} contains whitespace.
thanks again guys.