Skip to content

Instantly share code, notes, and snippets.

@emmapersky
Created November 22, 2010 18:44
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 emmapersky/710415 to your computer and use it in GitHub Desktop.
Save emmapersky/710415 to your computer and use it in GitHub Desktop.
GDI Ruby. Class 3. Form Submissions
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