Add valisation message and try catch in php scripts