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

creating a form and a submit button, while using instance variables t… #4

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
@name = params[:name]
@coach = params[:coach]
@pg = params[:pg]
@sg = params[:sg]
@pf = params[:pf]
@c = params[:c]

erb :team
end
end
26 changes: 19 additions & 7 deletions views/newteam.erb
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basketball Team Signup</title>
</head>
<body>
</body>
</html>
<head>
<meta charset="UTF-8">
<title>Basketball Team Signup</title>
</head>

<body>
<h1>Create a Basketball Team!</h1>

<form method="POST" action="/team">
<label>Team Name: <input type="text" name="name" /></label><br/>
<label>Coach: <input type="text" name="coach" /></label><br/>
<label>Point Guard: <input type="text" name="pg" /></label><br/>
<label>Shooting Guard: <input type="text" name="sg" /></label><br/>
<label>Small Forward: <input type="text" name="sf" /></label><br/>
<label>Power Forward: <input type="text" name="pf" /></label><br/>
<label>Center: <input type="text" name="c" /></label><br/>
<input type="submit" id="Submit" />
</form>
</body>
</html>

21 changes: 13 additions & 8 deletions views/team.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Basketball Team</title>
</head>
<body>

<head>
<meta charset="UTF-8">
<title>Basketball Team</title>
</head>


</body>
<body>
<h2>Team Name: <%= @name %></h2>
<h2>Coach: <%= @coach %></h2>
<h2>Point Guard: <%= @pg %></h2>
<h2>Shooting Guard: <%= @sg %></h2>
<h2>Small Forward: <%= @sf %></h2>
<h2>Power Forward: <%= @pf %></h2>
<h2>Center: <%= @c %></h2>
</body>
</html>