Params from html form

Hello everyone, need some quick assistance.

Having difficulty grabbing these two variables and including them in a post url.

You can see ruby pulls the POST variables as expected (testing using p params or params.to_s)

{“e”=>“77”, “a”=>"", “save”=>“Save Info”}

in my .rb file I have the following:

post ‘/1.php’ do
#puts params.inspect
#p params
#params.to_s
postData = Net::HTTP.post_form(URI.parse(‘[http://XXXXXX.com/1.php](http://xxxxxx.com/1.php)’), {‘save’=>‘Save Info’, ‘e’=>‘params[:e]’, ‘a’=>‘params[:a]’})
puts postData.body

end

Now when I submit my form in the logs i see:

Array
(
[save] => Save Info
[e] => params[:e]
[a] => params[:a]
)
params[:e] info saved!
127.0.0.1 - - [18/Jul/2019:19:55:54 -0400] “POST /1.php HTTP/1.1” 200 - 0.0208

It shows whats in the ‘’ and not the actual variables. Now, I have tried all sorts of different things to pull the params but nothing seems to work. Can somebody tell me how i can pull each variable properly?

Thank you in advance.

figured it out. sheesh. solution for anyone else wondering

postData = Net::HTTP.post_form(URI.parse(‘http://XXXX.com/1.php’), {‘save’=>params[:save], ‘e’=>params[:e], ‘a’=>[:a]})

      • [19/Jul/2019:12:34:18 -0400] “GET /main.css HTTP/1.1” 200 219 0.0048
        Array
        (
        [save] => Save Info
        [e] => 7
        [a] => a
        )
        7 info saved!
        127.0.0.1 - - [19/Jul/2019:12:34:24 -0400] “POST /1.php HTTP/1.1” 200 - 0.0221
1 Like

---- ignore

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.