-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathroot.html.erb
More file actions
61 lines (46 loc) · 2.23 KB
/
root.html.erb
File metadata and controls
61 lines (46 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<h1>課題用ページ!!!!!!!</h1>
<% require 'pg' %>
<% connection = PG::connect(dbname: "goya") %>
<% connection.internal_encoding = "UTF-8" %>
<form action="indicate.cgi" method="POST">
下記に文字を入力してください<br><br>
<input type="text" name="input" ><br>
<input type="submit" name="送信" >
</form>
<% result = connection.exec("select weight, give_for from crops;") %>
<% result_not_selfcons = connection.exec("select weight, give_for from crops WHERE NOT (give_for = '自家消費');") %>
<% result_quality_false = connection.exec("select weight, give_for, quality from crops WHERE quality = false;") %>
<% data = [] %>
<% data_2 = [] %>
<% data_3 = [] %>
<% result.each do |record| %>
<% data << "ゴーヤの大きさ:#{record["weight"]} 売った相手:#{record["give_for"]}" %>
<% end %>
<% result_not_selfcons.each do |record| %>
<% data_2 << "ゴーヤの大きさ:#{record["weight"]} 売った相手:#{record["give_for"]}" %>
<% end %>
<% result_quality_false.each do |record| %>
<% data_3 << "ゴーヤの大きさ:#{record["weight"]} 売った相手:#{record["give_for"]} 品質:#{record["quality"]}" %>
<% end %>
<form action="goya.cgi" method="POST">
下記のボタンを押すと、ゴーヤの大きさと売った相手の情報ページに飛びます<br><br>
<input type="text" name="goya" value="<%= data.join(' ') %>">
<input type="submit" name="送信" >
</form>
<form action="goya.cgi" method="POST">
下記のボタンを押すと、自家消費を除くゴーヤの情報ページに飛びます<br><br>
<input type="text" name="goya" value="<%= data_2.join(' ') %>">
<input type="submit" name="送信" >
</form>
<form action="goya.cgi" method="POST">
下記のボタンを押すと、低品質なゴーヤの情報ページに飛びます<br><br>
<input type="text" name="goya" value="<%= data_3.join(' ') %>">
<input type="submit" name="送信" >
</form>
</body>
</html>