回答編集履歴
2
調整
answer
CHANGED
@@ -46,4 +46,71 @@
|
|
46
46
|
eof;
|
47
47
|
|
48
48
|
?>
|
49
|
+
```
|
50
|
+
|
51
|
+
#追記
|
52
|
+
```PHP
|
53
|
+
<?php
|
54
|
+
|
55
|
+
//初期設定
|
56
|
+
$selected["budget"]=array_fill_keys(["B001","B002","B003"],'');
|
57
|
+
$selected["food"]=array_fill_keys(["R031","R032"],'');
|
58
|
+
$selected["credit_card"]=array_fill_keys(["c01","c02"],'');
|
59
|
+
|
60
|
+
//値セット
|
61
|
+
$budget=filter_input(INPUT_GET,"budget",FILTER_DEFAULT,["options"=>["default"=>""]]);
|
62
|
+
$food=filter_input(INPUT_GET,"food",FILTER_DEFAULT,["options"=>["default"=>""]]);
|
63
|
+
$credit_card=filter_input(INPUT_GET,"credit_card",FILTER_DEFAULT,["options"=>["default"=>""]]);
|
64
|
+
|
65
|
+
$selected["budget"][$budget]=" selected";
|
66
|
+
$selected["food"][$food]=" selected";
|
67
|
+
$selected["credit_card"][$credit_card]=" selected";
|
68
|
+
|
69
|
+
$param="";
|
70
|
+
|
71
|
+
if($budget!==""){
|
72
|
+
$param.=($param==="")?"?":"&";
|
73
|
+
$param.="budget=".urlencode($budget);
|
74
|
+
}
|
75
|
+
if(!in_array("",[$food,$credit_card])){
|
76
|
+
$param.=($param==="")?"?":"&";
|
77
|
+
$param.="food=".urlencode($food)."&credit_card=".urlencode($credit_card);
|
78
|
+
}
|
79
|
+
if($budget!=="" || !in_array("",[$food,$credit_card])){
|
80
|
+
$url="http://webservice.recruit.co.jp/hotpepper/gourmet/v1/".$param;
|
81
|
+
print $url."<br>";
|
82
|
+
}
|
83
|
+
print <<<eof
|
84
|
+
<html>
|
85
|
+
<head>
|
86
|
+
<title>API_SAMPLE</title>
|
87
|
+
</head>
|
88
|
+
<body>
|
89
|
+
<form method="GET">
|
90
|
+
<select name="budget">
|
91
|
+
<option value="">=== 選択して ===</option>
|
92
|
+
<option value="B001"{$selected["budget"]["B001"]}>~2000円</option>
|
93
|
+
<option value="B002"{$selected["budget"]["B002"]}>2001円~3000円</option>
|
94
|
+
<option value="B003"{$selected["budget"]["B003"]}>3001円~4000円</option>
|
95
|
+
</select>
|
96
|
+
<input type="submit" name="search" value="検索">
|
97
|
+
</form>
|
98
|
+
<form method="GET">
|
99
|
+
<select name="food">
|
100
|
+
<option value="">=== 選択して ===</option>
|
101
|
+
<option value="R031"{$selected["food"]["R031"]}>ステーキ</option>
|
102
|
+
<option value="R032"{$selected["food"]["R032"]}>カレー・ハヤシライス</option>
|
103
|
+
</select>
|
104
|
+
<select name="credit_card">
|
105
|
+
<option value="">=== 選択して ===</option>
|
106
|
+
<option value="c01"{$selected["credit_card"]["c01"]}>VISA</option>
|
107
|
+
<option value="c02"{$selected["credit_card"]["c02"]}>マスター</option>
|
108
|
+
</select>
|
109
|
+
<input type="submit" name="search" value="検索">
|
110
|
+
</form>
|
111
|
+
</body>
|
112
|
+
</html>
|
113
|
+
eof;
|
114
|
+
|
115
|
+
?>
|
49
116
|
```
|
1
修正
answer
CHANGED
@@ -21,18 +21,25 @@
|
|
21
21
|
<body>
|
22
22
|
<form method="GET">
|
23
23
|
<select name="budget">
|
24
|
+
<option value="">=== 選択して ===</option>
|
24
25
|
<option value="B001"{$selected["budget"]["B001"]}>?2000円</option>
|
25
26
|
<option value="B002"{$selected["budget"]["B002"]}>2001円?3000円</option>
|
26
27
|
<option value="B003"{$selected["budget"]["B003"]}>3001円?4000円</option>
|
27
28
|
</select>
|
29
|
+
<input type="submit" name="search" value="検索">
|
30
|
+
</form>
|
31
|
+
<form method="GET">
|
28
32
|
<select name="food">
|
33
|
+
<option value="">=== 選択して ===</option>
|
29
34
|
<option value="R031"{$selected["food"]["R031"]}>ステーキ</option>
|
30
35
|
<option value="R032"{$selected["food"]["R032"]}>カレー・ハヤシライス</option>
|
31
36
|
</select>
|
32
37
|
<select name="credit_card">
|
38
|
+
<option value="">=== 選択して ===</option>
|
33
39
|
<option value="c01"{$selected["credit_card"]["c01"]}>VISA</option>
|
34
40
|
<option value="c02"{$selected["credit_card"]["c02"]}>マスター</option>
|
41
|
+
</select>
|
35
|
-
<
|
42
|
+
<input type="submit" name="search" value="検索">
|
36
43
|
</form>
|
37
44
|
</body>
|
38
45
|
</html>
|