PHP GET parameter aan URL toevoegen
Dit wilde ik oplossen met de GET functie maar stuit nu op een probleem: er kan al gefilterd worden op genre maar ik heb geen idee hoe ik de parameter voor het filteren op maand kan toevoegen.
De opzet van de url zou er als volgt uit moeten komen te zien: main.php?genre=pop/rock&maand=05.
Het probleem zit 'm erin dat het genre "onthouden" dient te worden voordat er op maand gefilterd wordt. Zodat iemand die de Pop/Rock concerten van juni aan het bekijken is en vervolgens naar de maand juli gaat, niet opeens weer Alle genres ziet.
Dus; heeft iemand een idee hoe ik "&maand=##" toevoeg aan een huidige url? Bedankt!
Voor de duidelijkheid; het huidige script.
Code (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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?php
include '../database.php';
$query = 'SELECT * FROM concerten';
if(isset($_GET["genre"]))
{
$genre = mysql_real_escape_string($_GET["genre"]);
$query .= ' WHERE genrelijst="'.$genre.'"';
}
if(isset($_GET["maand"]))
{
$maand = mysql_real_escape_string($_GET["maand"]);
$query .= ' AND datum_maand="'.$maand.'"';
}
$query .= ' ORDER BY datum_maand, datum_dag DESC';
$result = mysql_query($query);
if ($result && mysql_num_rows($result) >= 1) {
echo'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Concertview</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
color: #ffffff;
font-size: 12px;
}
a {
text-decoration: none;
}
a.titellink {
text-decoration: none;
}
a.titellink:hover {
text-decoration: none;
color:#FC0;
}
a.menu:hover {
color:#F06;
}
a:link {
text-decoration: none;
color:#FFF;
}
a:visited {
text-decoration: none;
color:#FFF;
}
p {
font-family: Arial;
color: #ffffff;
font-size: 11px;
}
p.menu {
font-family: Tahoma, Geneva, sans-serif;
font-size: 14px;
font-weight: bold;
color: #FFFFFF;
text-align: center;
margin: 0;
padding-bottom: 6px;
}
p.titel {
font-family: Tahoma, Geneva, sans-serif;
font-size: 24px;
font-weight:bold;
color: #FFFFFF;
margin: 0;
}
p.omschrijving {
font-family: Tahoma, Geneva, sans-serif;
font-size: 12px;
color: #FFFFFF;
margin: 0;
}
p.datum {
font-family: Tahoma, Geneva, sans-serif;
font-size: 24px;
font-weight:bold;
color: #FFFFFF;
margin: 0;
}
</style>
</head>
<body bgcolor="#000000">
<div align="center">
<br />
<br />
<br />
<br />
<table width="673" cellpadding="0" cellspacing="0" border="0">
<tr>
<td> </td>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr height="30" rowspan="2">
<td align="left" rowspan="2"><font size="+4" face="Impact, Arial"></font><font size="+2"> concertview</font></td>
<td width="60" height="15" valign="bottom"><center><p class="menu"> <a class="menu" href="main.php">Alles</a> |</p></center></td>
<td width="80" height="15" valign="bottom"><center><p class="menu"> <a class="menu" href="?genre=pop/rock">Pop/Rock</a> |</p></center></td>
<td width="60" height="15" valign="bottom"><center><p class="menu"> <a class="menu" href="?genre=hiphop">Hip-Hop</a> |</p></center></td>
<td width="60" height="15" valign="bottom"><center><p class="menu"> <a class="menu" href="?genre=jazz">Jazz</a> |</p></center></td>
<td width="90" height="15" valign="bottom"><center><p class="menu"> <a class="menu" href="?genre=ska">Ska/Raggae</a> </p></center></td>
</tr>
<tr>
<td width="60" height="15" valign="top"><center><p class="menu"> </p></center></td>
<td width="60" height="15" valign="top"><center><p class="menu"> <a class="menu" href="?genre=gothic">Gothic</a> |</p></center></td>
<td width="80" height="15" valign="top"><center><p class="menu"> <a class="menu" href="?genre=punk/metal">Punk/Metal</a> |</p></center></td>
<td width="60" height="15" valign="top"><center><p class="menu"> <a class="menu" href="?genre=hardcore">Hardcore</a> |</p></center></td>
<td width="60" height="15" valign="top"><center><p class="menu"> <a class="menu" href="?genre=electronic">Electronic</a> </p></center></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<img src="images/november.gif" />
</td>
<td>
<table width="640" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td style="border: 1px solid #FFFFFF;" background="images/bg_november.jpg">
<!-- optredens -->';
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo'
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td height="64" valign="top" width="90" align="center">
<p class="datum">'.$row['datum_dag'].'</p>
</td>
<td height="64" valign="top" align="left">
<p class="titel"><a class="titellink" href="concertpagina.html">
'.$row['artiest'].'
</a></p>
<p class="omschrijving">
'.$row['omschrijving_kort'].'
</p>
</td>
<td height="64" valign="top" width="100" align="right">
<p style="margin-right: 20px;">
<b>VVK:</b> €'.$row['vvk_euro'].','.$row['vvk_cent'].'
<br />
<b>DEUR:</b> €'.$row['deur_euro'].','.$row['deur_cent'].'
</p>
</td>
</tr>
<tr>
<td colspan="2" bgcolor="#222222" align="right" height="27">
<p>
<b>Zaal open:</b> '.$row['zaal_uur'].':'.$row['zaal_minuut'].'
</p>
</td>
<td bgcolor="#222222" height="27">
<p>
<b>Aanvang:</b> '.$row['aanvang_uur'].':'.$row['aanvang_minuut'].'
</p>
</td>
</tr>';
}
echo' <tr>
<td colspan="3" height="15"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p><font color="FFFFFF"><a href="&maand=03">Maart</a></font></p>
</div>
</body>
</html>';
//}
} else {
echo 'Er is een probleem opgetreden, probeer het nog eens!';
}
?>
include '../database.php';
$query = 'SELECT * FROM concerten';
if(isset($_GET["genre"]))
{
$genre = mysql_real_escape_string($_GET["genre"]);
$query .= ' WHERE genrelijst="'.$genre.'"';
}
if(isset($_GET["maand"]))
{
$maand = mysql_real_escape_string($_GET["maand"]);
$query .= ' AND datum_maand="'.$maand.'"';
}
$query .= ' ORDER BY datum_maand, datum_dag DESC';
$result = mysql_query($query);
if ($result && mysql_num_rows($result) >= 1) {
echo'
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Concertview</title>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
color: #ffffff;
font-size: 12px;
}
a {
text-decoration: none;
}
a.titellink {
text-decoration: none;
}
a.titellink:hover {
text-decoration: none;
color:#FC0;
}
a.menu:hover {
color:#F06;
}
a:link {
text-decoration: none;
color:#FFF;
}
a:visited {
text-decoration: none;
color:#FFF;
}
p {
font-family: Arial;
color: #ffffff;
font-size: 11px;
}
p.menu {
font-family: Tahoma, Geneva, sans-serif;
font-size: 14px;
font-weight: bold;
color: #FFFFFF;
text-align: center;
margin: 0;
padding-bottom: 6px;
}
p.titel {
font-family: Tahoma, Geneva, sans-serif;
font-size: 24px;
font-weight:bold;
color: #FFFFFF;
margin: 0;
}
p.omschrijving {
font-family: Tahoma, Geneva, sans-serif;
font-size: 12px;
color: #FFFFFF;
margin: 0;
}
p.datum {
font-family: Tahoma, Geneva, sans-serif;
font-size: 24px;
font-weight:bold;
color: #FFFFFF;
margin: 0;
}
</style>
</head>
<body bgcolor="#000000">
<div align="center">
<br />
<br />
<br />
<br />
<table width="673" cellpadding="0" cellspacing="0" border="0">
<tr>
<td> </td>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr height="30" rowspan="2">
<td align="left" rowspan="2"><font size="+4" face="Impact, Arial"></font><font size="+2"> concertview</font></td>
<td width="60" height="15" valign="bottom"><center><p class="menu"> <a class="menu" href="main.php">Alles</a> |</p></center></td>
<td width="80" height="15" valign="bottom"><center><p class="menu"> <a class="menu" href="?genre=pop/rock">Pop/Rock</a> |</p></center></td>
<td width="60" height="15" valign="bottom"><center><p class="menu"> <a class="menu" href="?genre=hiphop">Hip-Hop</a> |</p></center></td>
<td width="60" height="15" valign="bottom"><center><p class="menu"> <a class="menu" href="?genre=jazz">Jazz</a> |</p></center></td>
<td width="90" height="15" valign="bottom"><center><p class="menu"> <a class="menu" href="?genre=ska">Ska/Raggae</a> </p></center></td>
</tr>
<tr>
<td width="60" height="15" valign="top"><center><p class="menu"> </p></center></td>
<td width="60" height="15" valign="top"><center><p class="menu"> <a class="menu" href="?genre=gothic">Gothic</a> |</p></center></td>
<td width="80" height="15" valign="top"><center><p class="menu"> <a class="menu" href="?genre=punk/metal">Punk/Metal</a> |</p></center></td>
<td width="60" height="15" valign="top"><center><p class="menu"> <a class="menu" href="?genre=hardcore">Hardcore</a> |</p></center></td>
<td width="60" height="15" valign="top"><center><p class="menu"> <a class="menu" href="?genre=electronic">Electronic</a> </p></center></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top">
<img src="images/november.gif" />
</td>
<td>
<table width="640" cellpadding="0" cellspacing="0" border="0">
<tr valign="top">
<td style="border: 1px solid #FFFFFF;" background="images/bg_november.jpg">
<!-- optredens -->';
while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo'
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td height="64" valign="top" width="90" align="center">
<p class="datum">'.$row['datum_dag'].'</p>
</td>
<td height="64" valign="top" align="left">
<p class="titel"><a class="titellink" href="concertpagina.html">
'.$row['artiest'].'
</a></p>
<p class="omschrijving">
'.$row['omschrijving_kort'].'
</p>
</td>
<td height="64" valign="top" width="100" align="right">
<p style="margin-right: 20px;">
<b>VVK:</b> €'.$row['vvk_euro'].','.$row['vvk_cent'].'
<br />
<b>DEUR:</b> €'.$row['deur_euro'].','.$row['deur_cent'].'
</p>
</td>
</tr>
<tr>
<td colspan="2" bgcolor="#222222" align="right" height="27">
<p>
<b>Zaal open:</b> '.$row['zaal_uur'].':'.$row['zaal_minuut'].'
</p>
</td>
<td bgcolor="#222222" height="27">
<p>
<b>Aanvang:</b> '.$row['aanvang_uur'].':'.$row['aanvang_minuut'].'
</p>
</td>
</tr>';
}
echo' <tr>
<td colspan="3" height="15"></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p><font color="FFFFFF"><a href="&maand=03">Maart</a></font></p>
</div>
</body>
</html>';
//}
} else {
echo 'Er is een probleem opgetreden, probeer het nog eens!';
}
?>
Er zijn nog geen reacties op dit bericht.