Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Completed Sinatra Forms Lab #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,18 @@

class App < Sinatra::Base

get '/newteam' do
erb :newteam
end

post '/team' do
@team_name = params[:name]
@coach = params[:coach]
@pg = params[:pg]
@sg = params[:sg]
@sf = params[:sf]
@pf = params[:pf]
@c = params[:c]
erb :team
end
end
36 changes: 29 additions & 7 deletions views/newteam.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
<!DOCTYPE html>
<html>
<head>
<head>
<meta charset="UTF-8">
<title>Basketball Team Signup</title>
</head>
<body>
</body>
</html>


</head>
<body>
<form action="/team" method="POST">
<br>
<label for="name">Team Name:</label>
<input type="text" id="name" name="name" /><br>
<br>
<label for="coach">Coach:</label>
<input type="text" id="coach" name="coach"/><br>
<br>
<label for="pg">Point Guard:</label>
<input type="text" id="pg" name="pg" /><br>
<br>
<label for="sg">Shooting Guard:</label>
<input type="text" id="sg" name="sg"><br>
<br>
<label for="sf">Small Forward:</label>
<input type="text" id="sf" name="sf" /><br>
<br>
<label for="pf">Power Forward:</label>
<input type="text" id="pf" name="pf"/><br>
<br>
<label for="c">Center:</label>
<input type="text" id="c" name="c"/><br>
<br>
<input id="submit" type="submit" value="Submit">
</form>
</body>
22 changes: 17 additions & 5 deletions views/team.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,22 @@
<title>Basketball Team</title>
</head>
<body>
<body>


</body>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basketball Team</title>
</head>
<body>
<h1>Team Information</h1>
<p><strong>Team Name:</strong> <%= @team_name %></p>
<p><strong>Coach:</strong> <%= @coach %></p>
<p><strong>Point Guard:</strong> <%= @pg %></p>
<p><strong>Shooting Guard:</strong> <%= @sg %></p>
<p><strong>Small Forward:</strong> <%= @sf %></p>
<p><strong>Power Forward:</strong> <%= @pf %></p>
<p><strong>Center:</strong> <%= @c %></p>
</body>
</html>