#!/usr/bin/env ruby require 'cgi' cgi = CGI.new name = cgi["onamae"] print(<<EOF) Content-type: text/html; charset=UTF-8 <!DOCTYPE html> <html lang="ja"> <head><title>Hello!</title> <meta charset="utf-8"> <style> body {background: #efe;} </style> <body> <h1>こんにちは</h1> <p>#{name}さんこんにちは</p> <!-- #のあと {変数} で値が取り出せる --> <form action="index.rb" method="POST"> <p>おなまえ<input name="onamae" type="text"> </p> <input type="submit"><input type="reset"> </form> EOF