Help building view to pass query to controller

I am very new to programming and would like to configure the following:

I want to configure a page that displayes some graphs. These graphs
pull its data from a sql table. What I would like to do is configure a
view .erb to have a search field that will take text and inject it to
part of a pre-configured sql query I have setup in a model. I will try
to explain as best I can with code.

Specifically I would like to set a view form that will take the text and
pass that text value to the class vars i have defined (@@hostname,
@@start_time and @@end_time). Once the VARs have user inputted values
the code will run and result to display. I think I am going to be
dealing with form_tags adn I have attemped this way but with no luck.
I hope I explained this correctly as again I am a programming newbie.
Thanks in advanced for any input.

Model:

class Health < ActiveRecord::Base
def self.sql_select_graph(hostname, start_time, end_time)
connection.execute(“set @c = 0”)
find_by_sql(“select *, @c FROM healths WHERE router_hostname =
‘#{hostname}’ AND created_at >= ‘#{start_time}’ AND created_at <= ‘#{
end_time}’ HAVING (@c:=@c+1)%12=0 ORDER BY id”)

end
end

Controller:

class BandwidthController < ApplicationController
@@hostname = ‘cps-6-elem-2790-rtr-01’
@@start_time = ‘2008-04-04 17:000:00’
@@end_time = ‘2008-04-04 18:00:00’


def rtr_bandwidth

g = Graph.new
@f = Health.sql_select_graph(@@hostname, @@start_time, @@end_time)



end