(PHP) Get repeated data (MySQL) from a value in a dropdown list and show it in a table
===

this is my first question in stackoverflow, but i use it a lot to search for other´s question that resembles my problems, however now has come the time to make my own question with a problem i´m having.

i have a file that has a dropdown list with a set of values (matricula) from a database (movimentos) what i want is when i select that value in the dropdown list it searches the database for repeated rows and it shows it in a table with all the data from that value (it´s currently 3 collums, "matricula,"marca" and "despesa")

Below is the code i use to get the value from the dropdown list, and this is where i have the problem, i cant get the value from the dropdown list to show the respective rows in the table

  

     <a href='verificar.dwt.php'>Voltar atrás</a>
    
    <div align="center"><? 
    
    include 'configmov.dwt.php'; 
    
    $tableName='movimentos';
    $matricula = mysql_real_escape_string($_POST['matricula']);
    
    $sql="SELECT matricula, marca, despesa FROM $tableName WHERE $matricula in (SELECT matricula FROM $tableName GROUP BY $matricula HAVING count($matricula) > 1)"; 
    $result=mysql_query($sql); 
    $n=1; 
    
    echo "Os seus resultados: <p>";
    
    echo "<table border=0>";
    echo "<tr bgcolor='#CCFFCC'>";
    echo "<td style='width: 100px;'>Matricula</td>";
    echo "<td style='width: 100px;'>Marca</td>";
    echo "<td style='width: 100px;'>Despesa</td>";
    echo "</tr>";
    
    while($row = mysql_fetch_array($result)){ 
    	echo "<table border=0>";
    	echo "<tr bgcolor='#CCCCCC'>";
    	echo "<td style='width: 100px;'>".$row['matricula']."</td>";
    	echo "<td style='width: 100px;'>".$row['marca']."</td>";
    	echo "<td style='width: 100px;'>".$row['despesa']."</td>";
    	echo "</tr>";
      
    }
    
    ?>
    
    </div>
    
    <?php
    // close connection; 
    mysql_close();
    ?>

I´m around this problem for a while and i did a lot of research before coming here to make this question, thanks in advance for every help you can give me