can anybody tell me how to get the values from querystring.

thanx in advance to all..

Recommended Answers

All 8 Replies

can anybody tell me how to get the values from querystring.

thanx in advance to all..

params[:param_name]

So say for example you're using pagination and you want the page_number param list?page_number=1 :

params[:page_number]

thanx pty for quick reply,

but if i have suppose 7 parameters in query string and i want to access the value for all 7 parameters in one go, how can i do that..

thanx pty for quick reply,

but if i have suppose 7 parameters in query string and i want to access the value for all 7 parameters in one go, how can i do that..

The params are in a hash (eg {"action"=>"list", "filter"=>"closed", "controller"=>"issue"} . If you want to iterate through them for example use:

params.each do |key, value|
  #do something fancy!
end

hi pty,

is there any special function to retrive the complete query string path,i have read from manual that this function is used to retrieve complete string,
ENV,but i am not able to get it working.

env["QUERY_STRING"] should work.

thanx gary for your reply but i want to know that ,do i need to install or include some file to get it working as its not working if i only add this line of code only.

Try using controller.env, where controller is the name of the controller where you are using this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.