Post HTML input field values to next page (using bare Plugs)

I am new to elixir and has just started to learn the platform. I am trying to build a simple HTML registration form and I want to POST the values inserted in the input fields to the next page and display the same there. How do I do this?

What have you tried so far?

I have made the HTML form and using read_body function I have send the data to the next page, but as you might know, this will only give me a string output with all the input values in the same, single string. I saw somewhere that using Plug.Parsers I can get the input values in a key-value pair format. I want to know how to implement that

Maybe I’m wrong here, shouldn’t it already been parsed into the second argument of your action?

post "/output.html" do 
     {:ok, data, _conn} = read_body(conn)
     send_resp(conn, 200, data) 

this is what I have done

Thats not an action, are you doing that in your router? Any reason why you don’t just route to an action?

yes I am doing it in my router

Any reason why you don’t just route to an action?

Between the router and the action, there is still stuff happening, eg. the afforementioned parsing of the body and then passing it into the second argument of the router.

It will skip even more than just that parsing.

So unless you have a strong reason for not using a controller and action, you shouldn’t use function-plugs in the router.