ok el codigo paso a paso seria el siguiente:
este me ayuda a abrir la informacion de un php
Código Javascript
:
Ver original<script>
function cargar(){
var n=document.getElementById('bus').value;
if(n==''){
document.getElementById("myDiv").innerHTML="";
document.getElementById("myDiv").style.border="0px";
document.getElementById("pers").innerHTML="";
return;
}
loadDoc("q="+n,"conexion/proc.php",function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
document.getElementById("myDiv").style.border="1px solid #A5ACB2";
document.getElementById("myDiv").style.width="100px";
}else{ document.getElementById("pers").innerHTML='';
}
});
}
//-------------------------------
function myFunction2(cod){
loadDoc("vcod="+cod,"conexion/proc2.php",function(){
if (xmlhttp.readyState==4 && xmlhttp.status==200){
document.getElementById("pers").innerHTML=xmlhttp.responseText;
}});
}
</script>
seguido el html
Código HTML:
Ver original<form action="conexion/editar.php" method="post" name="agregar" id="agregar"> <div id="pers" class="pers"></div>
el primer php "proc"que busca y llama al php"proc2" que tiene los botones y inputs
Código PHP:
Ver original<?php
include("../../conexion/conectar_bd_global.php");
$q=$_POST['q'];
$conexion=conectar_bd();
$sql="select * from tabla_alumnos where maestro LIKE '".$q."%'";
echo '<b>No hay alumnos</b>';
}else{
echo '<div class="sugerencias" onclick="myFunction2('.$fila["no"].')">
'.$fila['no'].'</div>';
}
?>
y el php "proc2" que en resumen solo pondré los botones y dos inputs aqui carga los datos del alumno para poder editar
Código PHP:
Ver originalecho '
<input value="'.$alumnonombre.'" type="text" name="alumno" id="alumno" size="9" required readonly>
<input value="'.$alumnoapellido.'" type="text" name="apellido" id="apellido" size="9" required readonly>
<div class="btncenter" align="center">
<input type="submit" name="enviar" value="Editar" >
<input type="submit" name="delete" value="Borrar" >
</div>
';
y el ultimo php seria el accion del form.