Validations (when not saving to the database)

I've setup a quoting system that does a quick job of displaying a price
to a user. I works ok but I need to validate that the user has actually
selected a course and a duration, hopefully with a feedback message. At
the moment this all works apart from if a user submits a blank form
(then I understandably get a nill object error)

How do I do this?

Here's the code so far...