OK...
The first codes where a test... Now I have written it for the real use..
It is a database of songs and composers...
I have 7 songs in the sql database for test right now...
Komponist means composer
Stil means style
and Titel means Title
Right now, as you can see here http://www.enjoymusic.dk/Filterform.php
it filters the name i choose of the list.. It was supposed to list only the name I choose... So when I go to the site both the drop down menu's should be at Not Chosen (these are not made yet, since I don't know how) and all the 7 songs should be listed.. Then you should be able to choose Rock in the second menu, and it should list all the Rock songs only... If if there are still many songs, you should be able to choose a composer in the first menu, so it only shows Rock songs by this composer... And off cause you should be able to switch off one of the filters again...
Here are my codes, and I really really apresiate you help...
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php
$conn = mysql_connect("localhost", "My udername", "My password");
mysql_select_db("enjoymusic_dk");
?>
<form method="post" action='<?=$_SERVER[PHP_SELF]?>'>
<select name=Komponist onChange=this.form.submit();>
<option value="Michael Henriksen" <?=($POST['Komponist']=="Michael Henriksen")?"selected":""?>>Michael Henriksen</option>
<option value="Morten Andersen" <?=($POST['Komponist']=="Morten Andersen")?"selected":""?>>Morten Andersen</option>
</select>
<select name=Stil onChange=this.form.submit();>
<option value="Pop" <?=($POST['Stil']=="Pop")?"selected":""?>>Pop</option>
<option value="Rock" <?=($POST['Stil']=="Rock")?"selected":""?>>Rock</option>
</select>
</form>
<?
if($POST){
$kom=$POST['Komponist'];
$sti=$_POST['Stil'];
}
$opt1=($kom!="")?" AND Komponist!='$kom'":"";
$opt2=($Sti!="")?" AND Stil!='$sti'":"";
$result = mysql_query("SELECT * FROM Titler WHERE 1 $opt1 $opt2");
{
while ($row = mysql_fetch_array($result)) {?>
<table width="500" border="0">
<tr>
<td width='200'><?echo $row["Titel"]."</td>
<td width='200'>".$row["Komponist"]."</td>
<td width='100'>".$row["Stil"]."</td>
</tr>
</table>";
}}
mysql_close($conn);
?>
</body>
</html>