回答編集履歴

1

追記

2016/11/13 06:52

投稿

退会済みユーザー
test CHANGED
@@ -61,3 +61,129 @@
61
61
  </html>
62
62
 
63
63
  ```
64
+
65
+
66
+
67
+ ---
68
+
69
+
70
+
71
+ ```html
72
+
73
+ <?php
74
+
75
+ /**
76
+
77
+ * index.php
78
+
79
+ */
80
+
81
+ require 'common.php';
82
+
83
+ ?><!DOCTYPE HTML>
84
+
85
+ <html lang="ja">
86
+
87
+ <head>
88
+
89
+ <meta charset="UTF-8">
90
+
91
+ <title></title>
92
+
93
+ </head>
94
+
95
+ <body>
96
+
97
+ <form action="confirm.php" method="post">
98
+
99
+ <select name="count">
100
+
101
+ <?php foreach ($arr as $key => $val): ?>
102
+
103
+ <option value="<?= $key; ?>"><?= $val; ?></option>
104
+
105
+ <?php endforeach; ?>
106
+
107
+ </select>
108
+
109
+ <button>送信</button>
110
+
111
+ </form>
112
+
113
+ </body>
114
+
115
+ </html>
116
+
117
+ ```
118
+
119
+
120
+
121
+ ```html
122
+
123
+ <?php
124
+
125
+ /**
126
+
127
+ * confirm.php
128
+
129
+ */
130
+
131
+ require 'common.php';
132
+
133
+ ?>
134
+
135
+ <!DOCTYPE HTML>
136
+
137
+ <html lang="ja">
138
+
139
+ <head>
140
+
141
+ <meta charset="UTF-8">
142
+
143
+ <title></title>
144
+
145
+ </head>
146
+
147
+ <body>
148
+
149
+ <div>
150
+
151
+ <p>個数 : <?= $arr[filter_input(INPUT_POST, 'count')]; ?></p>
152
+
153
+ </div>
154
+
155
+ </body>
156
+
157
+ </html>
158
+
159
+ ```
160
+
161
+
162
+
163
+ ```html
164
+
165
+ <?php
166
+
167
+
168
+
169
+ /**
170
+
171
+ * common.php
172
+
173
+ */
174
+
175
+ $arr = array(
176
+
177
+ 0 => 'なし'
178
+
179
+ , 1 => '一個'
180
+
181
+ , 2 => '二個'
182
+
183
+ , 3 => '三個'
184
+
185
+ , 4 => '四個'
186
+
187
+ );
188
+
189
+ ```