Params from web 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(‘xxxxx.com’), {‘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 variable. 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(‘XXXX’), {‘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

Next question. How do I get the post request to display back in my browser as opposed to the console log? I am sending a post request w/ info to an external site, I want the actual external page to show with the update changes. Current .rb:

post ‘/1.php’ do

#postData = Net::HTTP.post_form(URI.parse(‘website/1.php’), {‘e’=>params[:e], ‘a’=>params[:a], ‘save’=>params[:save] })
#puts postData.body

if !params[:save].nil?
postData = Net::HTTP.post_form(URI.parse(‘website/1.php’), {‘save’=>params[:save], ‘e’=>params[:e], ‘a’=>params[:a]})
puts postData.body

elsif !params[:disp].nil?
postData = Net::HTTP.post_form(URI.parse(‘website1.php’), {‘disp’=>params[:disp], ‘e’=>params[:e], ‘a’=>params[:a]})
puts postData.body

elsif !params[:vall].nil?
postData = Net::HTTP.post_form(URI.parse(‘http://website/1.php’), {‘vall’=>params[:vall], ‘e’=>params[:e], ‘a’=>params[:a]})
puts postData.body

end

end