<html>
 <head>
 
  <style type="text/css">
   select {
     width: 300px;
     height: 100px;
   }
  </style>
 
  <script type="text/javascript">
  
   function AddToSecondList(){
     var fl = document.getElementById('firstlist');
     var sl = document.getElementById('secondlist');    
     for (i = 0; i < fl.options.length; i++){
       if(fl.options[i].selected){
         sl.add(fl.options[i],null);
       }
     }
     return true;
   }
   
   function DeleteSecondListItem(){
     var fl = document.getElementById('firstlist');
     var sl = document.getElementById('secondlist');    
     for (i = 0; i < sl.options.length; i++){
       if(sl.options[i].selected){
         fl.add(sl.options[i],null);
       }
     }
     return true;
   }
  
  </script>
 
 </head>
 <body>  
 
<?php 
 function Conectarse()
 {
  if (!($link=mysql_connect("localhost","root","pollpoly")))
  { 
      echo "Error conectanddo a la base de datos...";
      exit();
  }
  if (!mysql_select_db("correspondencia",$link))
  { 
      echo "Error seleccionando la base de datos...";
      exit();
  }
      return $link;
 }
 function personalc()
 {
  $link=Conectarse();
  $sql="SELECT Nombre_personal FROM personalcapaseg";
  $result=mysql_query($sql, $link);
  $i=0;
  while ($row=mysql_fetch_row($result)) 
   { 
       echo "<option value=".$row[$i].">".$row[$i]."</option>\n"; 
   } 
 }
?>
  <form action="none">
   <div>
    <select id="firstlist" multiple="multiple">
       <?php personalc();?>
    </select>
 
<br>
    <input type="button" value="Agregar" 
     onclick="AddToSecondList();" /input>
    <input type="button" value="Eliminar" 
      onclick="DeleteSecondListItem();" /input>  
<br>
    <select id="secondlist" multiple="multiple">
    </select>   
 
  </div>
   
  </form>
 </body>
</html>