I understand how to generate objects from the database, using Sinatra with formatting, and I understand from tutorials how to use POST to send information back, but I don't understand how to use POST to transfer information from the browser (for instance from a text field, or inside <p id="stufftotransfer"><%= @stuff.each do || stuff.name %></p>) back to the database and store it to show it's working.

Basically in Sinatra, if you want to display something as output you do something like this ->


get '/items' do
  erb :items #for example

#Actually this is items.erb for instance. I can't get .erb to pass format check
<html> <% @items.each do | item | %> <div class="itemContainer"> <p><%= h item.name %></p>]
<p><%= h item.price %></p> <p><%= h item.id %></p> <p><%= h item.description %> </p> <a href="/addItem" class="itemContainer-link productItem btn btn-
primary">Add to Cart</a> <% end %> </html>

From there: adding the item to an element of a document generated by another .erb (inside itemList)
2) sending it back via 'POST'


post '/addItem' do
   erb :itemlist #Template that will store the value in a <p>,etc

post '/backtodatabase' do
   #? Grab value off element of .erb send it back and store in a table