very minor change-add trim()

Add the trim($var) function 2 remove trailing whitespaces when
sanitizing. Good practice I guess..