changeset 2193:67896a5ba5ad

cgi test now
author FUJIKAWA Kosuke <c111126@g.koeki-u.ac.jp>
date Thu, 06 Feb 2014 20:32:53 +0900
parents 8a5387980347
children 1115f4ff23c4
files nakamachi/plas.rb nakamachi/practice.html
diffstat 2 files changed, 43 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nakamachi/plas.rb	Thu Feb 06 20:32:53 2014 +0900
@@ -0,0 +1,22 @@
+#!/usr/bin/env ruby
+#coding: euc-jp
+
+require 'cgi'
+require 'cgi/session'
+cgi = CGI.new(:accept_charset=>"EUC-JP")
+print("Content-type: text/html; charset=EUC-JP\n\n")
+
+math1 = cgi["math1"].to_i
+math2 = cgi["math2"].to_i
+
+printf(<<_EOS_,math1,math2,math1+math2)
+<html>
+<head>
+<title>たしざん</title>
+</head>
+<body>
+<h1>足し算結果</h1>
+<p>%d + %d = %d</p>
+</body>
+</html>
+_EOS_
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nakamachi/practice.html	Thu Feb 06 20:32:53 2014 +0900
@@ -0,0 +1,21 @@
+<html>
+<head>
+<title>れんしゅう</title>
+<style type="text/css">
+</style>
+<link rel="stylesheet" type="text/css" href=".css">
+</head>
+
+<body>
+<p>足算します。足したい数いれてね</p>
+<form method="POST" action="./plas.rb">
+<p>
+<input type="textarea" name="math1">+
+<input type="textarea" name="math2">
+</p>
+<input type="submit" value="たす">
+<input type="reset" value="やりなおし">
+</form>
+<address>c111126@g.koeki-u.ac.jp</address>
+</body>
+</html>

yatex.org