# Post Methods

**URL:** <https://www.ruby-forum.com/t/post-methods/184440>\
**Category:** Rails\
**Created:** [March 2, 2010, 4:44pm UTC](https://www.ruby-forum.com/t/post-methods/184440 "2010-03-02T16:44:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alvaro\_Diaz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@Alvaro\_Diaz](https://www.ruby-forum.com/u/Alvaro_Diaz)\
**Post date:** [March 2, 2010, 4:44pm UTC](https://www.ruby-forum.com/t/post-methods/184440/1 "2010-03-02T16:44:50Z")

</div>

Hello!, I’m a RoR begginer, i need it to make a web interface for a  
bigger project that i’m developing in Ruby, but i don’t know how to do  
the next:

I want to read a config file of my main program (a normal conf file),  
and be able to change some values.  
I take all the names and values pf my config file correctly via a ruby  
function, to change the values i think in a form which has a lot of  
inputs named like the vars i want to change, and send the new value.  
My post command it’s correct for me, it contains the data i want  
(something like [name]value[name]value…) , but i don’t know how i  
can access to the post variable to work with this data in Ruby ( i  
need to write a file [name] \n value …)  
The code for my form its:

\<% form\_for :variable , :legend =\> “Personal info”, :url =\> {:action  
=\> :save\_post} do |$dataform| %\>  
…#Read my file …  
…  
Name: \<%=text\_field\_tag("#{var\_name}", “#{value}”, :size =\> 20)%\>

  
\<%= submit\_tag “Change Config File”, :class =\> “submit” %\>

so, how can i access to the post variable?

Thanks!

---

<div class="post-metadata">

**Author:** ![Alvaro\_Diaz](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/eb9ed0/32.png) [@Alvaro\_Diaz](https://www.ruby-forum.com/u/Alvaro_Diaz)\
**Post date:** [March 2, 2010, 5:39pm UTC](https://www.ruby-forum.com/t/post-methods/184440/2 "2010-03-02T17:39:18Z")

</div>

Within your controller action you can do:

params[:my\_param\_name]

Assuming you’ve done something like PHP before, it’s the equivalent to  
PHP’s:

$\_POST[“my\_param\_name”]

Cheers,

Andy

–  
Andy J.  
[http://andyjeffries.co.uk/](http://andyjeffries.co.uk/)#rubyonrails #mysql #jquery  
Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS  
Company number: 5452840
