質問編集履歴

3

内容変更

2018/08/07 03:38

投稿

Nitta
Nitta

スコア96

test CHANGED
File without changes
test CHANGED
@@ -66,7 +66,7 @@
66
66
 
67
67
  <option value="{{$pref}}" @if($pref==[ここ??をどのように]) selected @endif>{{$pref}}</option>
68
68
 
69
- <option value="{{$pref2}}" @if($pref=={{$pref2}}) selected @endif>{{$pref2}}</option>
69
+ <option value="{{$pref2}}" @if($pref==[ここ??をどのように]) selected @endif>{{$pref2}}</option>
70
70
 
71
71
  ```
72
72
 

2

内容変更

2018/08/07 03:38

投稿

Nitta
Nitta

スコア96

test CHANGED
File without changes
test CHANGED
@@ -66,6 +66,8 @@
66
66
 
67
67
  <option value="{{$pref}}" @if($pref==[ここ??をどのように]) selected @endif>{{$pref}}</option>
68
68
 
69
+ <option value="{{$pref2}}" @if($pref=={{$pref2}}) selected @endif>{{$pref2}}</option>
70
+
69
71
  ```
70
72
 
71
73
  以上、宜しくお願いします。

1

内容変更

2018/08/07 03:36

投稿

Nitta
Nitta

スコア96

test CHANGED
File without changes
test CHANGED
@@ -8,19 +8,63 @@
8
8
 
9
9
  ・現在
10
10
 
11
- ```
12
-
13
- <option value="茨城県" @if($pref=='茨城県') selected @endif>茨城県</option>
11
+ list.blade.php
14
12
 
15
13
  ```
16
14
 
15
+ <select name="pref" class="form-control select select-primary mbl" data-toggle="select">
17
16
 
17
+ <option value="">{{$mess}}</option>
18
+
19
+ <optgroup label={{$mess2}>
20
+
21
+ <option value="{{$pref}}" @if($pref=={{$pref}}) selected @endif>{{$pref}}</option>
22
+
23
+ <option value="{{$pref2}}" @if($pref=={{$pref2}}) selected @endif>{{$pref2}}</option>
24
+
25
+ </optgroup>
26
+
27
+ ```
28
+
29
+ ↑上記ではエラー構文エラー(syntax error, unexpected '<' )が出ます。
30
+
31
+ web.php
32
+
33
+ ```
34
+
35
+ (一部省略)
36
+
37
+ $str=mb_convert_encoding("全国","utf-8","sjis");
38
+
39
+ $str2=mb_convert_encoding("四国","utf-8","sjis");
40
+
41
+ $my_st=mb_convert_encoding("愛媛県","utf-8","sjis");
42
+
43
+ $my_st2=mb_convert_encoding("香川県","utf-8","sjis");
44
+
45
+
46
+
47
+ $hash=array(
48
+
49
+ 'mess'=>$str,
50
+
51
+ 'mess2'=>$str2,
52
+
53
+ 'pref'=>$my_st,
54
+
55
+ 'pref2'=>$my_st2,
56
+
57
+ );
58
+
59
+ return view('pref.list')->with($hash);
60
+
61
+ ```
18
62
 
19
63
  ・修正したい箇所
20
64
 
21
65
  ```
22
66
 
23
- <option value="{{$pref}}" @if($pref==[ここ??]) selected @endif>{{$pref}}</option>
67
+ <option value="{{$pref}}" @if($pref==[ここ??をどのように]) selected @endif>{{$pref}}</option>
24
68
 
25
69
  ```
26
70