Yo lo haría de esta manera:
Código PHP:
Ver original<table cellpadding="10" cellmargin="5" border="1">
<tr>
<th>Cod</th>
<th>Cedula</th>
<th>Nombre</th>
<th>Apellido</th>
<th>Programa</th>
<th>Carrera</th>
<th>Opciones</th>
</tr>
<?php
foreach($model as $row)
{
?>
<tr>
<td><input type="hidden" name="cod" id="cod<?php echo $row['cod'] ?>" value="<?php echo $row['cod'] ?>" /></td>
<td><input type="text" name="cedula" id="ced<?php echo $row['cod'] ?>" value="<?php echo $row['cedula'] ?>" /></td>
<td><input type="text" name="nombre" id="nom<?php echo $row['cod'] ?>" value="<?php echo $row['nombre'] ?>" /> </td>
<td><input type="text" name="apellido" id="ape<?php echo $row['cod'] ?>" value="<?php echo $row['apellido'] ?>" /></td>
<td><input type="text" name="programa" id="pro<?php echo $row['cod'] ?>" value="<?php echo $row['programa'] ?>" /></td>
<td><input type="text" name="carrera" id="car<?php echo $row['cod'] ?>" value="<?php echo $row['carrera'] ?>" /></td>
<td><button type="button" id="<?php echo $row['cod'] ?>" onClick="datos(this.id); openVentana();">Editar</button><button type="button" onClick="window.location='eliminar.php?cod=<?php echo $row['cod'] ?>' ">Eliminar</button></td>
</tr>
<?php
}
?>
</table>
<br>
<br>
<div>
<?php
$pagination->pages("btn");
?>
</div>
</center>
<div class="ventana" id="inicio">
<div class="formedi" >
<div class="cerrar"><a href="javascript:closeVentana();"><img height='20px' width='20px' src="./imagenes/close.png"></a></div>
<h3>Editar Usuarios</h3>
<form action="actualizar.php" method="post">
<input type="hidden" name="cod" id="cod_mod" value="" />
<br><br>
<label> Cedula: </label>
<input type="text" name="cedula" id="ced_mod" value="" />
<br>
<br>
<label> Nombre: </label>
<input type="text" name="nombre" id="nom_mod" value="" />
<br>
<br>
<label> Apellido: </label>
<input type="text" name="apellido" id="ape_mod" value="" />
<br>
<br>
<label> Programa: </label>
<input type="text" name="programa" id="pro_mod" value="" />
<br>
<br>
<label> Carrera: </label>
<input type="text" name="carrera" id="car_mod" value="" />
<br>
<br>
<br>
<input type="submit" value="actualizar">
</form>
</div>
</div>
</div>
<table class="pie">
<tr>
<td class="pieletra" align="middle"> Copyright © 2016 | PNF Informatica Nocturno.
<br>Todos los Derechos Reservados.</td>
</tr>
</table>
Código Javascript
:
Ver originalfunction datos(X){
document.getElementById('cod_mod').value = $("#cod"+X).val();
document.getElementById('ced_mod').value = $("#ced"+X).val();
document.getElementById('nom_mod').value = $("#ced"+X).val();
document.getElementById('ape_mod').value = $("#ape"+X).val();
document.getElementById('pro_mod').value = $("#pro"+X).val();
document.getElementById('car_mod').value = $("#car"+X).val();
}
Muestra funcionando:
http://codepen.io/anon/pen/EyaxBK
Claro no abre el modal por obvias razones, pero verás como se copian los datos en los campos a los que corresponde. Saludos