Documentation says Sinatra also supports query Parameters optional:
Routes may also use query Parameters:
get '/posts' do
# matches "GET /posts?title=foo&author=bar"
title = params[:title]
author = params[:author]
# uses title and author variables; query is optional to the /posts route
end
Source: http://www.sinatrarb.com/intro.html
So you can use one if
simple to find out if a parameter exists:
require "sinatra"
get "/foo" do
params[:bar] if params[:bar]
end
In the above example:
localhost:5678/foo # retorna uma página em branco
localhost:5678/foo?bar=foobar # retorna "foobar"
So I think one way to solve your problem would be to create each field with a number on the back:
<input type="text" name="campo1"/>
<input type="text" name="campo2"/>
<input type="text" name="campo3"/>
<input type="text" name="campo4"/>
And then you could use a loop loop to check if the field exists and do what you need with it.
From what I understand, each added field will be one registration and not a spine from a table, right? That wasn’t very clear.
– user7261