Ver Mensaje Individual
  #3 (permalink)  
Antiguo 13/11/2014, 15:29
EdyArgueta
 
Fecha de Ingreso: abril-2014
Mensajes: 51
Antigüedad: 10 años
Puntos: 1
Respuesta: Undefined index submit

ok el codigo paso a paso seria el siguiente:

este me ayuda a abrir la informacion de un php
Código Javascript:
Ver original
  1. <script>
  2.    
  3.     function cargar(){
  4.    
  5.     var n=document.getElementById('bus').value;
  6.    
  7.     if(n==''){
  8.    
  9.      document.getElementById("myDiv").innerHTML="";
  10.      document.getElementById("myDiv").style.border="0px";
  11.      document.getElementById("pers").innerHTML="";
  12.  
  13.    
  14.      return;
  15.     }
  16.    
  17.     loadDoc("q="+n,"conexion/proc.php",function(){
  18.    
  19.       if (xmlhttp.readyState==4 && xmlhttp.status==200){
  20.    
  21.         document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
  22.         document.getElementById("myDiv").style.border="1px solid #A5ACB2";
  23.         document.getElementById("myDiv").style.width="100px";
  24.         }else{  document.getElementById("pers").innerHTML='';
  25.         }
  26.    
  27.       });
  28.          
  29.     }
  30.    
  31.     //-------------------------------
  32.    
  33.     function myFunction2(cod){
  34.     loadDoc("vcod="+cod,"conexion/proc2.php",function(){
  35.    
  36.       if (xmlhttp.readyState==4 && xmlhttp.status==200){
  37.    
  38.         document.getElementById("pers").innerHTML=xmlhttp.responseText;
  39.         }});
  40.     }
  41.    
  42.     </script>
seguido el html
Código HTML:
Ver original
  1. <div id="myDiv">
  2. </div>
  3. <form action="conexion/editar.php" method="post" name="agregar" id="agregar">
  4. <div id="pers" class="pers"></div>
  5. </form>

el primer php "proc"que busca y llama al php"proc2" que tiene los botones y inputs

Código PHP:
Ver original
  1. <?php
  2.     include("../../conexion/conectar_bd_global.php");  
  3. $q=$_POST['q'];
  4. $conexion=conectar_bd();
  5.  
  6. $sql="select * from tabla_alumnos where maestro LIKE '".$q."%'";
  7. $res=mysql_query($sql,$con);
  8.  
  9. if(mysql_num_rows($res)==0){
  10.  
  11. echo '<b>No hay alumnos</b>';
  12.  
  13. }else{
  14.  
  15. while($fila=mysql_fetch_array($res))
  16.  
  17.   echo '<div class="sugerencias" onclick="myFunction2('.$fila["no"].')">
  18.  '.$fila['no'].'</div>';
  19.  }
  20.  
  21. ?>

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 original
  1. echo '
  2. <input value="'.$alumnonombre.'" type="text" name="alumno" id="alumno" size="9" required readonly>
  3. <input value="'.$alumnoapellido.'" type="text" name="apellido" id="apellido" size="9" required readonly>
  4.  
  5.  
  6.  
  7.         <div class="btncenter" align="center">
  8.        <input type="submit" name="enviar" value="Editar" >
  9.         <input type="submit" name="delete" value="Borrar" >
  10.        </div>
  11. ';

y el ultimo php seria el accion del form.