Created
November 22, 2010 18:44
-
-
Save emmapersky/710415 to your computer and use it in GitHub Desktop.
GDI Ruby. Class 3. Form Submissions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'sinatra' | |
get '/' do | |
erb :index | |
end | |
post '/say_hello' do | |
@name = params[:name] | |
erb :form | |
end | |
__END__ | |
@@ index | |
<html> | |
<head> | |
<title>Say Hello!</title> | |
</head> | |
<body> | |
<form method='post' action='/say_hello'> | |
<input type='text' name='name' /> | |
<input type='submit' /> | |
</form> | |
</body> | |
</html> | |
@@ form | |
<html> | |
<head> | |
<title>Say Hello!</title> | |
</head> | |
<body> | |
<h1>Hello <%= @name %></h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment