質問編集履歴

1

コードを修正

2016/11/08 10:28

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -14,19 +14,41 @@
14
14
 
15
15
  parse_str($param, $str);
16
16
 
17
-
17
+
18
18
 
19
19
  // 配列の要素として出力
20
20
 
21
- foreach ($str as $key => $value){
21
+ $food = http_build_query(array_merge($str,array('business' => 'food')));
22
22
 
23
- $para .= $key.'='.$value.'&';
23
+ $susi = http_build_query(array_merge($str,array('b_detail' => 'susi')));
24
24
 
25
- }
25
+ $ramen = http_build_query(array_merge($str,array('b_detail' => 'ramen')));
26
26
 
27
- $ex_serach = 'http://localhost/url.php?'.$para;
27
+ $serv = http_build_query(array_merge($str,array('business' => 'serv')));
28
28
 
29
+ $fashion = http_build_query(array_merge($str,array('b_detail' => 'fashion')));
30
+
31
+ $clean = http_build_query(array_merge($str,array('b_detail' => 'clean')));
32
+
33
+ $kanto = http_build_query(array_merge($str,array('region' => 'kanto')));
34
+
35
+ $saitama = http_build_query(array_merge($str,array('area' => 'saitama')));
36
+
37
+ $tokyo = http_build_query(array_merge($str,array('area' => 'tokyo')));
38
+
39
+ $tohoku = http_build_query(array_merge($str,array('region' => 'tohoku')));
40
+
41
+ $miyagi = http_build_query(array_merge($str,array('area' => 'miyagi')));
42
+
43
+ $hukusima = http_build_query(array_merge($str,array('area' => 'hukusima')));
44
+
45
+
46
+
29
- echo $ex_serach;
47
+ $foodGet = $_GET['business'];
48
+
49
+ $servGet = $_GET['business'];
50
+
51
+ $areaGet = $_GET['region'];
30
52
 
31
53
  ?>
32
54
 
@@ -44,33 +66,87 @@
44
66
 
45
67
  <h1>詳細検索</h1>
46
68
 
69
+ <!--業種で選ぶここから-->
70
+
47
71
  <section>
48
72
 
49
- <h2 class="toggle"><a href="http://localhost/url.php?business=food">飲食業</a></h2><!--大カテゴリ-->
73
+ <h2 class="toggle"><a href="http://localhost/url.php?<?php echo $food; ?>">飲食業</a></h2><!--業種大カテゴリ-->
50
74
 
51
- <div class="mini_wrap">
75
+ <?php if($foodGet == 'food'): ?>
52
76
 
53
- <p><a href="<?php echo $ex_serach; ?>b_detail=susi">寿司</a></p><!--小カテゴリ-->
77
+ <div class="mini_wrap">
54
78
 
55
- <p><a href="<?php echo $ex_serach; ?>b_detail=ramen">ラーメン</a></p><!--小カテゴリ-->
79
+ <p><a href="http://localhost/url.php?<?php echo $susi; ?>">寿司</a></p><!--小カテゴリ-->
56
80
 
81
+ <p><a href="http://localhost/url.php?<?php echo $ramen; ?>">ラーメン</a></p><!--小カテゴリ-->
82
+
57
- </div>
83
+ </div>
84
+
85
+ <?php endif; ?>
58
86
 
59
87
  </section>
60
88
 
61
89
  <section>
62
90
 
91
+ <h2 class="toggle"><a href="http://localhost/url.php?<?php echo $serv; ?>">サービス</a></h2><!--業種大カテゴリ-->
92
+
93
+ <?php if($servGet == 'serv'): ?>
94
+
95
+ <div class="mini_wrap">
96
+
97
+ <p><a href="http://localhost/url.php?<?php echo $fashion; ?>">ファッション</a></p><!--小カテゴリ-->
98
+
99
+ <p><a href="http://localhost/url.php?<?php echo $clean; ?>">クリーニング</a></p><!--小カテゴリ-->
100
+
101
+ </div>
102
+
103
+ <?php endif; ?>
104
+
105
+ </section>
106
+
107
+ <!--業種で選ぶここまで-->
108
+
109
+
110
+
111
+ <!--エリアで選ぶここから-->
112
+
113
+ <section>
114
+
63
- <h2 class="toggle"><a href="<?php echo $ex_serach; ?>region=kanto">エリア</a></h2><!--大カテゴリ-->
115
+ <h2 class="toggle"><a href="http://localhost/url.php?<?php echo $kanto; ?>">関東エリア</a></h2><!--エリア大カテゴリ-->
116
+
117
+ <?php if($areaGet == 'kanto'): ?>
64
118
 
65
119
  <div class="mini_wrap">
66
120
 
67
- <p><a href="<?php echo $ex_serach; ?>area=saitama">埼玉</a></p><!--小カテゴリ-->
121
+ <p><a href="http://localhost/url.php?<?php echo $saitama; ?>">埼玉</a></p><!--小カテゴリ-->
68
122
 
69
- <p><a href="<?php echo $ex_serach; ?>area=tokyo">東京</a></p><!--小カテゴリ-->
123
+ <p><a href="http://localhost/url.php?<?php echo $tokyo; ?>">東京</a></p><!--小カテゴリ-->
70
124
 
71
125
  </div>
72
126
 
127
+ <?php endif; ?>
128
+
73
129
  </section>
130
+
131
+ <section>
132
+
133
+ <h2 class="toggle"><a href="http://localhost/url.php?<?php echo $tohoku; ?>">東北エリア</a></h2><!--エリア大カテゴリ-->
134
+
135
+ <?php if($areaGet == 'tohoku'): ?>
136
+
137
+ <div class="mini_wrap">
138
+
139
+ <p><a href="http://localhost/url.php?<?php echo $miyagi; ?>">宮城</a></p><!--小カテゴリ-->
140
+
141
+ <p><a href="http://localhost/url.php?<?php echo $hukusima; ?>">福島</a></p><!--小カテゴリ-->
142
+
143
+ </div>
144
+
145
+ <?php endif; ?>
146
+
147
+ </section>
148
+
149
+ <!--エリアで選ぶここまで-->
74
150
 
75
151
  <p><a href="http://localhost/url.php">初期化</a></p>
76
152