potresti aggiungere i ulsanti di modifica e cancellazione ad ogni riga e passargli l'ID di ogni record:

Codice PHP:
<?php
   
include "config.php";
   
connettiDb();
   
$sql="select * from maestri where sesso='uomo'";
   
$dati=mysql_query($sql);
   while(
$row=mysql_fetch_array($dati)) { ?>
      <tr><td><input type="button" value="modifica" onclick="window.open('modificaRecord?ID=<?php echo $row['ID']; ?>')" />
     <input type="button" value="modifica" onclick="window.open('cancellaRecord?ID=<?php echo $row['ID']; ?>')" />
     </td><td><input type="text" name="nome" readonly="readonly" value="<?php echo $row ['nome']; ?>" /></td> ';
      <td><input type="text" name="cognome" readonly="readonly" value="<?php echo $row ['cognome']; ?>" /></td>
      <td><input type="text" name="citta" readonly="readonly" value="<?php echo $row ['citta']; ?>" /></br></td>
      <td><input type="text" name="n_lez1" maxlength="3" size="3" /></td></tr>
<?php ?>