Ir al contenido


Foto

Múltiples Checkboxs y Base de Datos


  • Por favor identifícate para responder
No hay respuestas en este tema

#1 roselyn

roselyn

    Newbie

  • Miembros
  • Pip
  • 1 mensajes

Escrito 11 julio 2013 - 01:04

Hola soy nueva programando pero necesito una gran AYUDA de ustedes, no se si lo estoy haciendo bien  :grin: la cuestión es que  tengo 62 checkbox en un formulario con distintas tablas, y quisiera que se guardar cada una de la selecciones en cada tabla correspondiente y no se como hacerlo. Gracias de antemano aqui el codigo:

<?php

include ("bloqueDeSeguridad.php");

require ('controlador.php');



?>
<fieldset>

<head>

<link type="text/css" rel="stylesheet" href="estilos.css" />

<form  name="form_hematologia" method="POST" action="mensajes.php?action=3">

  <table  border="0" class="fuentes">
<legend><h4>HEMATOLOGIA:</h4></legend>

  <tr>

<td>C&eacute;dula:</td>

  <td><input name="txtced" type="text" maxlength="12" size="15"></td></tr>

  <tr>

  <td>Hematolog&iacute;a Completa</td>
  <td><input type="checkbox" name="hematologia" value="hemac"></td>
<td>Hemoglobina y Hematocrito</td>

<td><input type="checkbox" name="hemh" value="hemh"></td>
</tr>

<tr>

    <td>Contaje Blanco y F&oacute;rmula</td>

<td><input type="checkbox" name="contajebf" value="contajebf"></td>
  <td>Eritrosedimentaci&oacute;n</td>

<td><input type="checkbox" name="eritrosed" value="eritrosed"></td>

  </tr>
  <tr>

<td>Contaje de Plaquetas</td>

<td><input type="checkbox" name="contajep" value="contajep"></td>

      <td>Recuento de Eosinofilos</td>

<td><input type="checkbox" name="recuentoe" value="recuentoe"></td>

  </tr>

  <tr>

      <td>Investigaci&oacute;n de Drepanositos</td>

<td><input type="checkbox" name="investiga" value="investiga"></td>

  <td>Grupo Sangu&iacute;neo y Factor RH</td>

<td><input type="checkbox" name="gruposang" value="gruposang"></td>

  </tr>

  <tr>

      <td>Pruebas de Coombs</td>

<td><input type="checkbox" name="pruebac" value="pruebac"></td>

    <td>Tiempo de Protombina</td>

<td><input type="checkbox" name="tiempop" value="tiempop"></td>

  </tr>

  <tr>

    <td>Tiempo Parcial de Tromboplastina</td>

<td><input type="checkbox" name="tiempop" value="tiempopt"></td>

  <td>Dosificaci&oacute;n de Fibrinogeno</td>

<td><input type="checkbox" name="dosifica" value="dosifica"></td>

  </tr>

<tr>

      <td>Tiempo de Retracci&oacute;n de Co&aacute;gulo</td>

<td><input type="checkbox" name="tiemporc" value="tiemporc"></td>   

      <td>Tiempo de Sangr&iacute;a</td>

<td><input type="checkbox" name="tiemposa" value="tiemposa" ></td>

  </tr>
  </table>
  <legend><h4>QU&Iacute;MICA SANGU&Iacute;NEA:</h4></legend>
  <table>
  <tr>

    <td>Glicemia</td>

<td><input type="checkbox" name="glicemia" value= "glicemia"></td>
<td>Urea</td>
<td><input type="checkbox" name="urea" value= "urea"></td>
<td>Creatinina</td>
<td><input type="checkbox" name="creatinina" value= "creatinina"></td>
  </tr>
  <tr>
    <td>H.D.L. Colesterol</td>

<td><input type="checkbox" name="hdlc" value= "hdlc" ></td>
      <td>L.D.L. Colesterol</td>

<td><input type="checkbox" name="ldlc" value= "ldlc" ></td>
  <td>Proteinas Total Y Fraccionada</td>

<td><input type="checkbox" name="proteina" value= "proteina" ></td>
</tr>

  <tr>

<td>L&iacute;pidos y Totales</td>

<td><input type="checkbox" name="lipido" value= "lipido" ></td>
<td>Triglicerios</td>

<td><input type="checkbox" name="triglice" value= "triglice" ></td>
  <td>Bilirrubina Total y Fraccionada</td>

<td><input type="checkbox" name="bilirrub" value= "bilirrub"></td>
  </tr>

  <tr>

<td>C.K.</td>

<td><input type="checkbox" name="ck" value= "ck" ></td>

    <td>C.K.M.B.</td>

<td><input type="checkbox" name="ckmb" value= "ckmb" ></td>

      <td>Glutamil Transferrasa</td>

<td><input type="checkbox" name="glutamil" value= "glutamil" ></td>

  </tr>

  <tr>

      <td>Transaminasa G. Piruvica</td>

<td><input type="checkbox" name="transami" value= "transami" ></td>

<td>Transaminasa G. Oxalacetica</td>

<td><input type="checkbox" name="oxalace" value= "oxalace" ></td>

      <td>Fosfata Alcalina</td>

<td><input type="checkbox" name="fosfaal" value= "fosfaal" ></td>

  </tr>
  <tr>

    <td>Fosfata &Aacute;cida Total</td>

<td><input type="checkbox" name="fosfatt" value= "fosfatt" ></td>     

    <td>Fosfata &Aacute;cida Prost&aacute;tica</td>

<td><input type="checkbox" name="fosfatp" value= "fosfatp" ></td> 

<td>Deshidrogenasa L&aacute:ctica (LDH)</td>

<td><input type="checkbox" name="deshidro" value= "deshidro" ></td>

</tr>
<tr>

      <td>Amilasa</td>

<td><input type="checkbox" name="amilasa" value= "amilasa" ></td>

      <td>F&oacute;sforo Inorg&aacute;nico</td>

<td><input type="checkbox" name="fosfori" value= "fosfori" ></td>

      <td>Magnesio</td>

<td><input type="checkbox" name="magnesio" value= "magnesio" ></td>

  </tr>
  <tr>

  <td>Calcio</td>

<td><input type="checkbox" name="calcio" value= "calcio" ></td>

    <td>Hierro Serico</td>

<td><input type="checkbox" name= "hierro" Value= "hierro"></td>

      <td>Sodio</td>

<td><input type="checkbox" name="sodio" value= "sodio" ></td>

  </tr>
  <tr>


Y mi Acceso es el siguiente:

function Insertar_Hematologia($_POST)

{

$conexion =crear_conexion();



//comprueba que la hematologia no exista
$query = "select * from hematologia where ced_pac=".$_POST[txtced].""; 

$result = consulta_base_de_datos($query,$conexion);

  if (!$result || mysql_num_rows($result)!=0)

  {     

  $mensaje=1; //el registro ya existe

//liberar_resultados($result);

return $mensaje; 

      } 

  // inserta nuevo hematologia 

  $query ="insert into hematologia (id_he,ced_pac,hema_c,hemh,cb_formula,eritro,c_plaquet,c_reticu,r_eosinof,inv_drepan,gsan_frh,p_coob,t_proto,t_ptromb,dosi_fibr,t_ret_coag,t_sangria)";

  $query.= "values ('".$_POST[txtced]."','".$_POST[hemac]."','".$_POST[hemh]."','".$_POST[contajebf]."','".$_POST[eritrosed]."','".$_POST[contajep]."','".$_POST[recuentoe]."',
  '".$_POST[investiga]."','".$_POST[gruposang]."','".$_POST[pruebac]."','".$_POST[tiempop]."','".$_POST[tiempopt]."','".$_POST[dosifica]."','".$_POST[tiemporc]."','".$_POST[tiemposa]."')";

      $query ="insert into qsanguinea (id_gsa,glicemia,urea,creatin,colest_t,hdl_c,ldl_c,proteto,lipido_t,triglic,bilirru,ck,ckmb,glutamil,trans_p,trans_o,fosfa_al,fosfa_at,fosfa_ap,deshidro,
  amilasa,fosf_inorg,magnesio,calcio,hierros,sodio,potasio,cloro,a_urico,t_glucosa)";
  $query.= "values ('".$_POST[txtced]."','".$_POST[glicemia]."','".$_POST[urea]."','".$_POST[creatinina]."','".$_POST[hdlc]."','".$_POST[ldlc]."','".$_POST[proteina]."','".$_POST[lipido]."','".$_POST[triglice]."','".$_POST[bilirrub]."',
  '".$_POST[ck]."','".$_POST[ckmb]."','".$_POST[glutamil]."','".$_POST[transami]."','".$_POST[oxalace]."','".$_POST[fosfaal]."','".$_POST[fosfatt]."','".$_POST[fosfatp]."','".$_POST[deshidro]."','".$_POST[amilasa]."',
  '".$_POST[fosfori]."','".$_POST[calcio]."','".$_POST[hierro]."','".$_POST[sodio]."','".$_POST[potasio]."','".$_POST[cloro]."','".$_POST[acido]."','".$_POST[tolera]."')";
  $query ="insert into hormonale (id_ho,ttotal,t_total,tlibre,t_libre,cortisol,fsh,tsh,lh,progest,porlac,insul,test_t,test_l,estrad,estriol,este_t,bhc)";
$query.= "values ('".$_POST[ttotale]."','".$_POST[ttotal]."','".$_POST[tlibr]."','".$_POST[tlibre]."','".$_POST[fsh]."','".$_POST[tsh]."','".$_POST[lh]."','".$_POST[proges]."','".$_POST[prolatina]."','".$_POST[insulina]."',
'".$_POST[testost]."','".$_POST[testosl]."','".$_POST[estradiol]."','".$_POST[estriol]."','".$_POST[extrogeno]."','".$_POST[bhcg]."')"; 
  $query ="insert into cropologia (id_cro,exa_hece,inv_sa_ocul,c_ah_trans,azu_reduc)";
$query.= "values ('".$_POST[examen]."','".$_POST[sangre]."','".$_POST[cinta]."','".$_POST[azucare]."')";
   
  $result = consulta_base_de_datos($query,$conexion);

  if (!$result)

  {

  $mensaje=2; //error al insertar los registro en la bd

//liberar_resultados($result);

return $mensaje;

  }

  else

  {

  $mensaje=3; //Los datos enviados han sido registrado Exitosamente!;

        }    

    return $mensaje;

cerrar_conexion($conexion);
}
  <td>Potasio</td>

<td><input type="checkbox" name="potasio" value= "potasio"></td>

      <td>Cloro</td>

  <td><input type="checkbox" name="cloro" value= "cloro" ></td>
<td>&Aacute;cido &Uacute;rico</td>

<td><input type="checkbox" name="acido" value= "acido" ></td>
</tr>
<tr>
      <td>Tolerancia Glucosada</td>

<td><input type="checkbox" name="tolera" value= "tolera" ></td>
  </tr>
</table>
<table>
<legend><h4>PRUEBAS HORMONALES:</h4></legend>
    <tr><td>T3 Totales</td>
<td><input type="checkbox" name="ttotale" value="ttotale"></td>
<td>T4 Totales</td>
<td><input type="checkbox" name="ttotal" value="ttotal"></td>
<td>T3 Libre</td>
<td><input type="checkbox" name="tlibr" value="tlibr" ></td></tr>
<tr><td>T4 Libre</td>
<td><input type="checkbox" name="tlibre" value="tlibre" ></td>
<td>F.S.H.</td>
<td><input type="checkbox" name="fsh" value="fsh" ></td>
<td>T.S.H.</td>
<td><input type="checkbox" name="tsh" value="tsh" ></td></tr>
<tr><td>L.H.</td>
<td><input type="checkbox" name="lh" value="lh"></td>
<td>Progesterona</td>
<td><input type="checkbox" name="proges" value="proges" ></td>
<td>Prolactina</td>
<td><input type="checkbox" name="prolatina" value="prolatina"></td></tr>
<tr><td>Insulina</td>
<td><input type="checkbox" name="insulina" value="insulina"></td>
<td>Testosterona Total</td>
<td><input type="checkbox" name="testost" value="testost" ></td>
<td>Testosterona Libre</td>
<td><input type="checkbox" name="testosl" value="testosl" ></td></tr>
<tr><td>Estradiol</td>
<td><input type="checkbox" name="estradiol" value="estradiol" ></td>
<td>Estriol</td>
<td><input type="checkbox" name="estriol" value="estriol"></td>
<td>Estr&ocute;genos Totales</td>
<td><input type="checkbox" name="extrogeno" value="extrogeno" ></td>
<tr><td>B.H.C.G</td>
<td><input type="checkbox" name="bhcg" value="bhcg" ></td></tr>
</table>
<legend><h4>CROPOLOG&IacuteA:</h4></legend>
<table>
<tr><td>Examen de Heces</td>
<td><input type="checkbox" name="examen" value="examen" ></td></tr>
<tr><td>Investigaci&oacute;n de Sangre Oculta</td>
<td><input type="checkbox" name="sangre" value="sangre"></td></tr>
<tr><td>Cinta Adhesiva Transparente</td>
<td><input type="checkbox" name="cinta" value="cinta"></td></tr>
<tr><td>Az&uacute;cares Reductores</td>
<td><input type="checkbox" name="azucare" value="azucare" ></td><tr>
</tr>
</table>
</fieldset>

    <tr>
    <td colspan="2" align="center">

<input type="submit" name="boton1" value="Ingresar" onClick="verif()">&nbsp; &nbsp;
<input type="reset" name="reset" value="Limpiar"><br><br>

<font color="FF00CC"  size="3">Todos los Datos son Obligatorios</font></td></tr>
  </table>

</fieldset>

  • 0




IP.Board spam blocked by CleanTalk.