added selected function which sets the value of a select dropdown with post values and optionally sets a default