keuzelijst met php
<code>
<table width="578" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="11" colspan="2"><img src="images/head.jpg" width="578" height="18" /></td>
</tr>
<tr>
<td>
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
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
<? include_once ("config.php");
$mysql_connection = mysql_connect ($dbhost, $dbuser, $dbpasswd) or die ("Connection failed");
mysql_select_db ($dbname) or die ("Selecting database failed");
$query = "SELECT * FROM pics order by datum desc
";
$res = mysql_query($query);
while($data = @mysql_fetch_array($res))
{
echo"<table width='578' border='0' cellspacing='0' cellpadding='3'>";
echo"<tr><td>";
echo"<table width='100%' border='0' cellspacing='' cellpadding='0'>";
echo"<tr><td class='mainmenu' colspan='2'><a href='".$data["link"]."' target='blank'>".$data["event"]."</a></td><tr>";
echo"<tr><td width='100' valign='top' class='mainmenu'>datum:</td><td class='mainmenu'>".$data["datum"]. "</td></tr>";
echo"<tr><td class='mainmenu'>Locatie:</td><td class='mainmenu'>".$data["spot"].", ".$data["plaats"]."</td></tr>";
echo"<tr><td colspan='2'>";
echo"<table border='0' cellspacing='0'>";
echo"<tr><td> </td></tr>";
echo"<td width='33%' align='left'><img src='".$data["thumb1"]."' width='100'></td>";
echo"<td width='33%' align='center'><img src='".$data["thumb2"]."' width='100'></td>";
echo"<td width='33%' align='right'><img src='".$data["thumb3"]."' width='100'></td></tr>";
echo"</table>";
echo"</td></tr>";
echo"<tr><td colspan='2' valign='bottom'><center><hr color='#666666' width='99%' size='1'></center></td></tr>";
echo"</table>";
echo"</table>";}
?>
$mysql_connection = mysql_connect ($dbhost, $dbuser, $dbpasswd) or die ("Connection failed");
mysql_select_db ($dbname) or die ("Selecting database failed");
$query = "SELECT * FROM pics order by datum desc
";
$res = mysql_query($query);
while($data = @mysql_fetch_array($res))
{
echo"<table width='578' border='0' cellspacing='0' cellpadding='3'>";
echo"<tr><td>";
echo"<table width='100%' border='0' cellspacing='' cellpadding='0'>";
echo"<tr><td class='mainmenu' colspan='2'><a href='".$data["link"]."' target='blank'>".$data["event"]."</a></td><tr>";
echo"<tr><td width='100' valign='top' class='mainmenu'>datum:</td><td class='mainmenu'>".$data["datum"]. "</td></tr>";
echo"<tr><td class='mainmenu'>Locatie:</td><td class='mainmenu'>".$data["spot"].", ".$data["plaats"]."</td></tr>";
echo"<tr><td colspan='2'>";
echo"<table border='0' cellspacing='0'>";
echo"<tr><td> </td></tr>";
echo"<td width='33%' align='left'><img src='".$data["thumb1"]."' width='100'></td>";
echo"<td width='33%' align='center'><img src='".$data["thumb2"]."' width='100'></td>";
echo"<td width='33%' align='right'><img src='".$data["thumb3"]."' width='100'></td></tr>";
echo"</table>";
echo"</td></tr>";
echo"<tr><td colspan='2' valign='bottom'><center><hr color='#666666' width='99%' size='1'></center></td></tr>";
echo"</table>";
echo"</table>";}
?>
</tr>
</table>
</code>
Graag zou ik daar een keuzemenu hebben die standaard op de huidige maand staat en enkel de maanden weergeeft die in die maand gebeuren
in de tabel zit er een veld maand waar de juiste maand iedere keer inzit maar tlukt me niet
help plz
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
$i = $i++ //maand 1 erbij
if ($i == date("n"))
{
echo "<OPTION VALUE='" . $i . "' SELECTED>" . $i . "</OPTION>";
}
else
{
echo "<OPTION VALUE='" . $i . "'>" . $i . "</OPTION>";
}
if ($i == date("n"))
{
echo "<OPTION VALUE='" . $i . "' SELECTED>" . $i . "</OPTION>";
}
else
{
echo "<OPTION VALUE='" . $i . "'>" . $i . "</OPTION>";
}
en dan voor de while nog:
echo "<SELECT NAME='datum'>";
en dan erna:
echo "</SELECT>";
edit: Ik had date("j") ipv date("n") :P
Gewijzigd op 17/03/2006 14:57:00 door - -
if ($i == date("n"))
hier heeft ie nog die fout
<FORM NAME="maandkeuze">
<SELECT NAME="toonmaand">
<OPTION>kies maand
<OPTION VALUE="januari">januari
<OPTION VALUE="februari">februari
</SELECT>
</FORM>
<table width="578" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="11" colspan="2"><img src="images/head.jpg" width="578" height="18" /></td>
</tr>
<tr>
<td>
Code (php)
1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
<? include_once ("config.php");
$mysql_connection = mysql_connect ($dbhost, $dbuser, $dbpasswd) or die ("Connection failed");
mysql_select_db ($dbname) or die ("Selecting database failed");
$query = "SELECT * FROM pics [b]where maand='maandkeuze'[/b] order by datum desc
";
$res = mysql_query($query);
while($data = @mysql_fetch_array($res))
dat vette is fout dat weet ik maar hoe zet ik dat dan wel juist?
$mysql_connection = mysql_connect ($dbhost, $dbuser, $dbpasswd) or die ("Connection failed");
mysql_select_db ($dbname) or die ("Selecting database failed");
$query = "SELECT * FROM pics [b]where maand='maandkeuze'[/b] order by datum desc
";
$res = mysql_query($query);
while($data = @mysql_fetch_array($res))
dat vette is fout dat weet ik maar hoe zet ik dat dan wel juist?