Skip to content

Instantly share code, notes, and snippets.

@jamesmartin
Last active July 18, 2017 07:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesmartin/ab52753be4ffb75be02a395add48842b to your computer and use it in GitHub Desktop.
Save jamesmartin/ab52753be4ffb75be02a395add48842b to your computer and use it in GitHub Desktop.
radio buttons and checkboxes
<h1>Test</h1>
<% if !@p.nil? %>
<%= @p.inspect %>
<% end %>
<form method="post" action="/">
<h2>Have you ever smoked?</h2>
<p>
<input type="radio" name="smoker" value="Yes"> Yes<br>
<input type="radio" name="smoker" value="No"> No<br>
</p>
<h2>Injury</h2>
<p>
<input type="checkbox" name="injury[]" value="Neck"> Neck<br>
<input type="checkbox" name="injury[]" value="Shoulders"> Shoulders<br>
<input type="checkbox" name="injury[]" value="Knee"> Knee<br>
</p>
<input type="submit" value="Go">
</form>
require 'sinatra'
get '/' do
erb :test, layout: false
end
post '/' do
@p = params
erb :test, layout: false
end
@jamesmartin
Copy link
Author

screen shot 2017-07-18 at 5 12 55 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment