質問編集履歴

1

追記

2016/12/13 07:11

投稿

nyowaa
nyowaa

スコア13

test CHANGED
File without changes
test CHANGED
@@ -62,11 +62,11 @@
62
62
 
63
63
  if($col['required'.$k]){
64
64
 
65
- echo"<input required type='radio' name='question{$question_count}[]' value='".$col['answer'.$j]."'>".$col['answer'.$j].'<br>';
65
+ echo"<input required type='radio' name='question{$question_count}' value='".$col['answer'.$j]."'>".$col['answer'.$j].'<br>';
66
66
 
67
67
  }else{
68
68
 
69
- echo"<input type='radio' name='question{$question_count}[]' value='".$col['answer'.$j]."'>".$col['answer'.$j].'<br>';
69
+ echo"<input type='radio' name='question{$question_count}' value='".$col['answer'.$j]."'>".$col['answer'.$j].'<br>';
70
70
 
71
71
  }
72
72
 
@@ -102,11 +102,11 @@
102
102
 
103
103
  if($col['required'.$k]){
104
104
 
105
- echo"<input required type='text' name='question{$question_count}[]' value=''>".$col['answer'.$j].'<br>';
105
+ echo"<input required type='text' name='question{$question_count}' value=''>".$col['answer'.$j].'<br>';
106
106
 
107
107
  }else{
108
108
 
109
- echo"<input type='text' name='question{$question_count}[]' value=''>".$col['answer'.$j].'<br>';
109
+ echo"<input type='text' name='question{$question_count}' value=''>".$col['answer'.$j].'<br>';
110
110
 
111
111
  }
112
112
 
@@ -124,7 +124,7 @@
124
124
 
125
125
  if($col['other'.$k]){
126
126
 
127
- echo $col['other'.$k]."<input type='text' name='question{$question_count}[]' id='question{$question_count}' value=''>";
127
+ echo $col['other'.$k]."<input type='text' name='question{$question_count}' id='question{$question_count}' value=''>";
128
128
 
129
129
  }
130
130
 
@@ -153,3 +153,115 @@
153
153
  PHPのバージョンは5.3.1です。
154
154
 
155
155
  エディタはサクラエディタを利用しています。
156
+
157
+
158
+
159
+ ###追記
160
+
161
+ ```HTML
162
+
163
+ <!DOCTYPE HTML>
164
+
165
+ <html>
166
+
167
+ <head>
168
+
169
+ <meta http-equiv="Content-Type" content="text/html" charset="UTF-8" ;/>
170
+
171
+ <link href="css/questionStyle.css" type="text/css" rel="stylesheet">
172
+
173
+ <title>アンケート</title>
174
+
175
+
176
+
177
+ <script>
178
+
179
+ $(document).ready(function(){
180
+
181
+ $("#form").validate({
182
+
183
+ rules:{
184
+
185
+ '#checkBtn': {required: true}
186
+
187
+ },
188
+
189
+ messages :{
190
+
191
+ '#checkBtn':{required: "1つ以上選択してください"}
192
+
193
+ },
194
+
195
+ errorPlacement :function(error,element){
196
+
197
+ if (element.attr("id") == "#checkBtn" ) error.insertAfter("#error");
198
+
199
+ else (element.attr("id") == "id" ) error.insertAfter(element);
200
+
201
+ }
202
+
203
+ });
204
+
205
+ });
206
+
207
+ </script>
208
+
209
+
210
+
211
+ </head>
212
+
213
+ <body>
214
+
215
+
216
+
217
+ <form action ="send.php" method="post" id="form">
218
+
219
+ <h1 align="center">あんけえと</h1>
220
+
221
+ <hr>
222
+
223
+ <div class="question" align="center">
224
+
225
+ <p>Q1.くえすちょん</p>
226
+
227
+ <p align="left" style="display:inline-block;">
228
+
229
+ <input type='checkbox' name='question1[]' value='いち' id='required'>いち<br>
230
+
231
+ <input type='checkbox' name='question1[]' value='に' id='required'>に<br>
232
+
233
+ <input type='checkbox' name='question1[]' value='さん' id='required'>さん<br>
234
+
235
+ <input type='checkbox' name='question1[]' value='よん' id='required'>よん<br>
236
+
237
+ <input type='checkbox' name='question1[]' value='ご' id='required'>ご<br>
238
+
239
+ <input type='hidden' name='question_id' value='1'>
240
+
241
+ </p>
242
+
243
+ </div>
244
+
245
+ <div align="right">
246
+
247
+ <input type="submit" value="送信する" id="send" class="send" name="send" style="width:100px; height:30px;">
248
+
249
+ </div>
250
+
251
+ </form>
252
+
253
+ <div id="error">
254
+
255
+ </div>
256
+
257
+ </body>
258
+
259
+ </html>
260
+
261
+ ```
262
+
263
+ > 質問はHTMLベースでおこなってください。
264
+
265
+
266
+
267
+ PHPをブラウザで開き、ソースをコピーしてみたのですが、このような感じであっていますでしょうか?