# Search Form

**URL:** <https://www.ruby-forum.com/t/search-form/107522>\
**Category:** Rails\
**Created:** [June 22, 2007, 2:48pm UTC](https://www.ruby-forum.com/t/search-form/107522 "2007-06-22T14:48:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Armitage](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/779978/32.png) [@Armitage](https://www.ruby-forum.com/u/Armitage)\
**Post date:** [June 22, 2007, 2:48pm UTC](https://www.ruby-forum.com/t/search-form/107522/1 "2007-06-22T14:48:29Z")

</div>

Hi All  
this is driving me batty.  
I am trying to do a search, the form I have created has radio buttons  
and a text field

\_full\_search.rhtml

Staff Number\<%= radio\_button\_tag(:search,:staff,0) %\> NI Number\<%= radio\_button\_tag(:search, :staff, 1) %\> File Number\<%= radio\_button\_tag(:search, :staff, 2) %\> name\<%= radio\_button\_tag(:search, :staff, 3) %\>

\<%= text\_field(:search\_text, "", "size"=\>10)%\>

The controller should then check which button is checked and search as  
appropriate, there is placeholder text for this as the moment as no  
matter which button I check, I always get the same output!  
help!  
controller  
def staff\_search  
@search\_text = params[:search]  
@word = params[:search\_text]  
if @search\_text = “staff0”  
@word = 1  
if @search\_text = “staff1”  
@word = 2  
if @search\_text = “staff2”  
@word = 3  
else @word = 2  
end  
end  
end  
end
