/
white-wine.php
151 lines (140 loc) · 6.21 KB
/
white-wine.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
require_once('private/initialize.php');
$page_title = 'Wine Guesser - White Wine';
include(SHARED_PATH . '/header.php');
if (is_post_request()) {
$guessed_wine_id_score = wine_guess_id(transform_wine_fields(sanitize_wine_fields($_POST, WHITE_WINE), WHITE_WINE), WHITE_WINE);
$_SESSION['wine_score'] = $guessed_wine_id_score[1];
redirect_to(url_for('/guess-white.php?id=' . u($guessed_wine_id_score[0])));
} else {
}
?>
<div class="center">
<h2>Select White Wine Characteristics</h2>
<form class="wine-form" action="/white-wine.php" method="post">
<table>
<tr>
<th colspan="3">Color</th>
</tr>
<tr>
<?php foreach (WHITE_WINE_COLOR_LABELS as $color => $label) {
echo "<td><label for=\"" . $color . "\">" . $label . "</label><input type=\"radio\" name=\"color\" id=\"" . $color . "\" value=\"" . $color . "\"></td>";
} ?>
</tr>
</table>
<table>
<tr>
<th colspan="4">Fruit Condition - Nose (Select up to two)</th>
</tr>
<tr>
<?php foreach (WHITE_NOSE_COND_LABELS as $condition => $label) {
echo "<td><label for=\"" . $condition . "\">". $label . "</label><br><input type=\"checkbox\"
name=\"" . $condition . "\" id=\"" . $condition . "\"
value=\"1\"></td>";
} ?>
</tr>
</table>
<table>
<tr>
<th colspan="4">Fruit Condition - Palate (Select up to two)</th>
</tr>
<tr>
<?php foreach (WHITE_PALATE_COND_LABELS as $condition => $label) {
echo "<td><label for=\"" . $condition . "\">" . $label . "</label><br><input type=\"checkbox\"
name=\"" . $condition . "\" id=\"" . $condition . "\"
value=\"1\"></td>";
} ?>
</tr>
</table>
<table>
<tr>
<th class="left">Fruit</th>
<th> </th>
<th>No</th>
<th>Yes</th>
<th>Key</th>
</tr>
<?php foreach (WHITE_WINE_FRUIT_LABELS as $fruit => $label) {
echo "<tr><td colspan=\"2\" class=\"left\"><label for=\"" . $fruit . "\">" . $label . "</label></td>";
for ($i = 0; $i <= 2; $i++) {
echo "<td><input type=\"radio\" name=\"" . $fruit . "\" id=\"" . $fruit . "\" value=" . $i;
if ($i == 0) { echo " checked"; } echo "></td>";
}
echo "</tr>";
} ?>
</table>
<table>
<tr>
<th class="left" colspan="2">Non-Fruit</th>
<th> </th>
<th> </th>
<th>No</th>
<th>Yes</th>
<th>Key</th>
</tr>
<?php
foreach (WHITE_WINE_NOTE_LABELS as $note => $label) {
echo "<tr><td colspan=\"4\" class=\"left\"><label for=\"" . $note . "\">" . $label . "</label></td>";
for ($i = 0; $i <= 2; $i++) {
echo "<td><input type=\"radio\" name=\"" . $note . "\" id=\"" . $note . "\" value=" . $i;
if ($i == 0) {
echo " checked";
}
echo "></td>";
}
echo "</tr>";
}
?>
</table>
<table>
<tr>
<th class="left">Structure</th>
<th>Dry</th>
<th>Off-Dry</th>
<th>Sweet</th>
</tr>
<tr>
<td class="left"><label for="sweetness">Sweetness:</label></td>
<?php foreach (WINE_SWEETNESS as $sweetness) {
echo "<td><input type=\"radio\" name=\"sweetness\" id=\"sweetness\" value=\"" . $sweetness . "\"></td>";
} ?>
</tr>
</table>
<table>
<tr>
<th class="left">Structure</th>
<th>Low/Mod. Minus</th>
<th>Moderate</th>
<th>Moderate Plus</th>
<th>High</th>
</tr>
<tr>
<td class="left"><label for="acid">Acid:</label></td>
<?php foreach (WINE_STRUCTURES as $structure) {
echo "<td><input type=\"radio\" name=\"acid\" id=\"acid\" value=\"" . $structure . "\"></td>";
} ?>
</tr>
<tr>
<td class="left"><label for="alcohol">Alcohol:</label></td>
<?php foreach (WINE_STRUCTURES as $structure) {
echo "<td><input type=\"radio\" name=\"alcohol\" id=\"alcohol\" value=\"" . $structure . "\"></td>";
} ?>
</tr>
</table>
<table>
<tr>
<th colspan="3">Climate</th>
</tr>
<tr>
<?php foreach (WINE_CLIMATES as $climate) {
echo "<td><label for=\"climate_" . $climate . "\">" . ucfirst($climate) . " </label><input type=\"radio\" name=\"climate\" id=\"climate_" . $climate . "\" value=\"" . $climate . "\"></td>";
} ?>
</tr>
</table>
<input class="center submit-btn" type="submit" value="Submit">
</form>
<p id="did-you-mean-it">Did you mean to guess a <a href="red-wine.php">red wine?</a></p>
</div>
<?php
include(SHARED_PATH . '/footer.php');
?>