Foros del Web » Programando para Internet » PHP »

PHP OO enviar datos por check box

Estas en el tema de enviar datos por check box en el foro de PHP en Foros del Web. @import url("http://static.forosdelweb.com/clientscript/vbulletin_css/geshi.css"); Código PHP: Ver original BUSCAR CURSO     <?php include ( 'conexion.php' ) ;   $dato = $_POST [ 'dato' ] ;   ...
  #1 (permalink)  
Antiguo 19/09/2015, 19:00
 
Fecha de Ingreso: septiembre-2015
Mensajes: 7
Antigüedad: 8 años, 7 meses
Puntos: 0
enviar datos por check box

Código PHP:
Ver original
  1. BUSCAR CURSO
  2.  
  3.  
  4. <?php
  5. include('conexion.php');
  6.  
  7. $dato = $_POST['dato'];
  8.  
  9. //EJECUTAMOS LA CONSULTA DE BUSQUEDA
  10.  
  11. $registro = mysql_query("SELECT * FROM rformacion WHERE naf LIKE '%$dato%' ORDER BY naf ASC");
  12.  
  13. //CREAMOS NUESTRA VISTA Y LA DEVOLVEMOS AL AJAX
  14.  
  15. echo '<table class="table table-striped table-condensed table-hover">
  16.             <tr>
  17.                 <th width="400">Cursos</th>
  18.                 <th width="200">Fecha inicio</th>
  19.                  <th width="400">Fecha Fin</th>
  20.                  <th width="400">Region</th>
  21.                  <th width="400">Gerencia</th>
  22.                  <th width="400">Departamento</th>
  23.                  <th width="400">Division</th>
  24.                  <th width="400">Ceco</th>
  25.                 <th width="50">Selecione</th>
  26.            </tr>';
  27. if(mysql_num_rows($registro)>0){
  28.     while($registro2 = mysql_fetch_array($registro)){
  29.         echo '<tr>
  30.                 <td>'.$registro2['naf'].'</td>
  31.                 <td>'.fechainicio($registro2['fechai']).'
  32.                 <td>'.fechafin($registro2['fechaf']).'</td>
  33.                 <td>'.$registro2['region'].'</td>
  34.                 <td>'.$registro2['gerencia'].'</td>
  35.                 <td>'.$registro2['depatamento'].'</td>
  36.                 <td>'.$registro2['division'].'</td>
  37.                 <td>'.$registro2['ceco'].'</td>
  38.                 <td><form  method="post" action="guardar.php">
  39.  <span id="bottonradio">
  40. <label>
  41.      <input type="radio" name="mostrar" value=" " />
  42.    </label>
  43. </form>
  44.  
  45.  
  46. <input type="submit" name="guardar" />
  47.  
  48.                 </tr>';
  49.     }
  50. }else{
  51.     echo '<tr>
  52.                 <td colspan="6">No se encontraron resultados</td>
  53.             </tr>';
  54. }
  55. echo '</table>';
  56. ?>





Código PHP:
Ver original
  1. BUSCAR TRABAJADOR
  2.  
  3.  
  4.   <?php
  5. include('conexion.php');
  6.  
  7. $dato = $_POST['dato'];
  8.  
  9. //EJECUTAMOS LA CONSULTA DE BUSQUEDA
  10.  
  11. $registro = mysql_query("SELECT * FROM rtrabajadores WHERE tindicador LIKE '%$dato%' ORDER BY tnombre ASC");
  12.  
  13. //CREAMOS NUESTRA VISTA Y LA DEVOLVEMOS AL AJAX
  14.  
  15. echo '<table class="table table-striped table-condensed table-hover">
  16.             <tr>
  17.                 <th width="300">Indicador</th>
  18.                 <th width="150">Cedula</th>
  19.                 <th width="150">Nombre</th>
  20.                  <th width="200">Apellido</th>
  21.                  <th width="200">Indicador Supervisor</th>
  22.                 <th width="50">Seleccione</th>
  23.            </tr>';
  24. if(mysql_num_rows($registro)>0){
  25.     while($registro2 = mysql_fetch_array($registro)){
  26.         echo '<tr>
  27.                 <td>'.$registro2['tindicador'].'</td>
  28.                 <td>'.$registro2['cedula'].'</td>
  29.                 <td>'.$registro2['tnombre'].'</td>
  30.                 <td>'.$registro2['tapellido'].'</td>
  31.                 <td>'.$registro2['indicadors'].'</td>
  32.                 </td>
  33.                 <td><a href="guardar.php"('.$registro2['tindicador'].');"<form id="form1" name="form1" method="get" action="guardar.php">
  34.  <span id="sprycheckbox1">
  35.    <label>
  36.      <input type="checkbox" name="checkbox1" id="checkbox1" />
  37.    </label>
  38.  
  39. </form>
  40.    
  41.  
  42.                 </tr>';
  43.     }
  44. }else{
  45.     echo '<tr>
  46.                 <td colspan="6">No se encontraron resultados</td>
  47.             </tr>';
  48. }
  49. echo '</table>';
  50. ?>


MI BUSCADOR
Código PHP:
Ver original
  1. <header><strong>CURSOS</strong></header>
  2.     <section>
  3.     <table border="0" align="center">
  4.         <tr>
  5.             <td width="333"><input type="text" placeholder="Busca un Curso " id="bsnaf"/></td>
  6.             <td width="142"><input type="date" id="bddesde"/></td>
  7.             <td width="50">Hasta&nbsp;&nbsp;&nbsp;&nbsp;</td>
  8.             <td width="142"><input type="date" id="bdhasta"/></td>
  9.         </tr>
  10.     </table>
  11.     </section>
  12.  
  13.     <div class="registros" id="resultados"></div>
  14.     <center></center>
  15.    
  16.            
  17.             <div class="modal-footer"></div>
  18.             </form>
  19.           </div>
  20.         </div>
  21.       </div>
  22.      
  23.  
  24.  <header>TRABAJADORES</header>
  25.     <section>
  26.     <table border="0" align="center">
  27.         <tr>
  28.             <td width="335"><input type="text" placeholder="Busca un trabajador " id="tindicador"/>
  29.             <td>&nbsp;</td>
  30.             <td>&nbsp;</td>
  31.             <td>&nbsp;</td>
  32.            
  33.             <td width="200">&nbsp;</td>
  34.         </tr>
  35.     </table>
  36.     </section>
  37. <center>
  38.       <ul class="pagination" id="pagination">
  39.         <div class="registros" id="trabajadores"></div>
  40.       </ul>
  41.      
  42.      
  43.   <td width="300"><p>&nbsp;</p>
  44.          <p>&nbsp;</p>
  45.     <p>&nbsp;</p>
  46.     <p align="center">&nbsp;</p>
  47.  
  48.    <p align="right"><a target="_blank" href="guardar.php" class="btn btn-danger">Registrar al participante   </a> </p>
  49.    <p align="right"> <a target="_blank" href="index.php" class="btn btn-danger"> Limpiar</a></p>
  50.   </center>

lo que yo requiero hacer es registrar ah los trabajadores en los cursos pero al registrarlos requiero datos del trabajador y del curso


base de datos

trabajador curso
nombre apellido cédula indicador nombre del curso, fecha inicio, fecha fin etc


por eso coloque el radio ah los cursos y el check box ah los trabajadores pero no se como enviar esos datos ah la base de datos.
podrian ayudarme o mas o menos que puedo hacer.
de ante mano gracias.
  #2 (permalink)  
Antiguo 19/09/2015, 19:43
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: enviar datos por check box

bueno te recomiendo lo siguiente, envia po medio del checkbox algun dato principal como el numero de identificacion o la id del trabajador, luego donde los quieras recuperar, realizas una doble consulta, por ejemplo:

Código PHP:
Ver original
  1. <?php
  2. //consulta de trabajadores en un Curso
  3. $trabaja = $db->query("SELECT * FROM Curso WHERE tema = '$_GET[tema]");
  4. $linea = mysqli_num_rows($trabaja);
  5.  
  6. if($linea >=1){
  7.     echo "<ul>";
  8.     while($row = $trabaja->fetch_array())
  9.     {
  10.         $numero = $row['numero'];//numero que registraste en el curso y que identifica a cada trabajador de manera individual
  11.         //buscamos al trabajador
  12.             $trabajador = $db->query("SELECT * FROM trabajadores WHERE numero = '$numero'");
  13.             $dato = $trabajador->fetch_assoc();
  14.            
  15.             echo "<li>".$dato['nombre']." ".$dato['apellido'];
  16.     }
  17.     echo "</ul>";
  18. } else{
  19.     echo "No hay trabajadores registrados en este curso";
  20. }
  21. ?>
por cierto de que trata tu web, digo para ayudarte mucho mejor, quiza alguna ideas. Saludos!!!
__________________
[email protected]
HITCEL
  #3 (permalink)  
Antiguo 19/09/2015, 21:40
 
Fecha de Ingreso: septiembre-2015
Mensajes: 7
Antigüedad: 8 años, 7 meses
Puntos: 0
Respuesta: enviar datos por check box

es que estoy haciendo pasantias y me pidieron una aplicación que genere reportes de los cursos ah los que asisten los trabajadores tienes mas funciones pero esta es como la 5ta y la que mas problema me dio ya que no querian un buscador simple. gracias dejame ver que puedo hacer amigo :).
  #4 (permalink)  
Antiguo 21/09/2015, 08:55
 
Fecha de Ingreso: septiembre-2015
Mensajes: 7
Antigüedad: 8 años, 7 meses
Puntos: 0
Respuesta: enviar datos por check box

no tendrías un ejemplo de algún checkbox y botton radio que envíen datos ah una base de datos ?

Etiquetas: box, fecha, mysql, registro, select, sql
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:55.