FORM creating based on input & database values

Hi

What’s the way to create form based on the retrieved input from the
post ?

Example:

I have action select:

def select
@imitem = Imitem.find(params[:id])
end

which reads ID (database ID) value from the post form. Now once I have
that ID I need to find out
if that IMITEM ID record on database has agreement=1 and if it is then
create a FORM1 and if
not then create a FORM2.

Do I need to make these definitions on controller section for SELECT
action or do I make those on select.html page
or is that even possible ?