La pagina php di partenza stampa il contenuto del db in una tabella html

codice:
<?php 

 function fetch_records($table_name, $fields){ 
        
                $conn = mysql_connect("localhost", "xxx", "xxx"); 
                $select_db = mysql_select_db("xxx", $conn); 
            
                if(!$conn){ 
                    return "Not able to connect to dabase...."; 
                } 
                
                $table = "<style type='text/css'>
<!--
@import url('style.css');
-->
</style>
				<table id='hor-minimalist-b' summary='Employee Pay Sheet'><tr><th scope='col'>id</th>, <th scope='col'>E-Mail</th>, <th scope='col'>Nome</th>, <th scope='col'>Cognome</th>, <th scope='col'>Matricola</th>, <th scope='col'>Dimora</th>, <th scope='col'>Telefono</th>, <th scope='col'>Sesso</th>, <th scope='col'>Nascita</th>, <th scope='col'>Diploma</th>, <th scope='col'>Superiori</th>, <th scope='col'>Istituto</th>, <th scope='col'>Maturita</th>, <th scope='col'>Iscrizione Uni</th>, <th scope='col'>N Esami</th>, <th scope='col'>Media</th>, <th scope='col'>Facolta</th>, <th scope='col'>Corso</th>, <th scope='col'>-</th>, <th scope='col'>Lingua 2</th>, <th scope='col'>Conoscenza</th>, <th scope='col'>Certificazione</th>, <th scope='col'>Lingua 3</th>, <th scope='col'>Conoscenza</th>, <th scope='col'>Certificazione</th>, <th scope='col'>Lingua 4</th>, <th scope='col'>Conoscenza</th>, <th scope='col'>Certificazione</th>, <th scope='col'>Lingua 5</th>, <th scope='col'>Conoscenza</th>, <th scope='col'>Certificazione</th>, <th scope='col'>Lingua 6</th>, <th scope='col'>Conoscenza</th>, <th scope='col'>Certificazione</th>, <th scope='col'>Tempo libero</th>, <th scope='col'>Skill</th>, <th scope='col'>info</th>, <th scope='col'>vp</th>, <th scope='col'>cv<th scope='col'></tr>"; 
                $cols = implode (', ', $fields); 
                $sql = "select $cols from $table_name";    
                $run = mysql_query($sql);    
                   
                    if($run){    
                        if(mysql_num_rows($run) == 0){ 
                                return "Sorry. No records found in the database";                        
                        } 
                        else { 
                                
                            while($arr = mysql_fetch_array($run, MYSQL_ASSOC)){ 
                                    $table .= "\t\t<tr>\n"; 
                                    
                                    foreach ($arr as $val_col) { 
                                    $table .= "\t\t\t".'<td>'.$val_col.'</td>'."\n"; 
                                    } 
                                        
                                    $table .= "\t\t</tr>\n";                                        
                            } 
                            $table .= "</table>"; 
                            return $table; 
                         } 
                        
                        mysql_free_result($run);        
                  } 
                  
                return "There was an error while fetching the records. Please contact site administrator."; 
 } 

//how to call the function 

        $table = "aaa_youin"; 
        $cols = array("id", "username", "nome", "cognome", "matricola", "dimora", "telefono", "sesso", "nascita", "diploma", "superiori", "istituto", "maturita", "iscrizioneuni", "nesami", "media", "l1", "e1", "c1", "l2", "e2", "c2", "l3", "e3", "c3", "l4", "e4", "c4", "l5", "e5", "c5", "l6", "e6", "c6", "perchete", "perchenonte", "info", "vp", "cv"); 
        echo fetch_records($table, $cols); 
?>
in una delle colonne ci sono gli indirizzi email. Io vorrei che cliccando sulla riga (mi accontento anche cliccando sulla mail) sia rimandato il contenuto della mail ad un altra pagina.


In altre parole clicco sull'email e nell'url compare: http://sito.com/php2.php?email=mails...nata@gmail.com


Se fosse creata staticamente basterebbe creare un link ma essendo creata dinamicamente come faccio?