#!/usr/bin/ruby #-*- coding: utf-8 -*- require 'sinatra' require 'erb' get '/post' do @name = "" erb :index end post '/' do @name = @params[:name] erb :index end __END__ @@index <html> <body> <form action="/" method="post"> <input type="text" name="name"> <input type="submit"> </form> </body> </html>