i am trying to access the data from a form.
<% form_tag(:action => "test") do %>
<p>
Name:
<%= text_field_tag("name","web programmer") %>
</p>
<%= submit_tag ("Save data") %>
<% end %>
this form is in views/challenges/show.html I have written this piece of code in challenges_controller
def test
@name = params[:name]
end
before_filter :test
now,If i try to access @name variable in views/challenges/show.html heres the code for that part
<% if @name != null %>
<%= @name %>
<% end %>
I get the following error "undefined local variable or method `null' "
i have addded the following route to my routes.rb
get 'challenges/test'
Can someone help me out with this issue?