Hello friends, I'm having problems with the materialize.css
checkboxes.
I'm doing a query in alphabetical order but when I try to make the selection of any medication it only lets me select the first of each letter, but if I remove the css
, it works perfectly and I can select whatever it is.
Does anyone know how to remove the css from a checkbox or something like that?
I attach the code the images so that they see.
<?php
//CONSULTA LETRA A
$consulta = $DB_con->query("SELECT * FROM medicamentos WHERE nombre_medicamento LIKE 'A%%' ORDER BY id;");
if($consulta->rowCount() > 0){
echo "<form class='col s12' action='recipe_medico.php'
name='frmContacto' method='post'>";
echo "<div class='letra' align='justify'
style='margin-left: -18px; overflow: auto; width: 260px; height: 480px;'>
<div 'center-align black-text thin' style='font-size: 22px;'>A<hr></div>
<div class='letra' align='justify' style='width: 370px;'>";
while ($linea = $consulta->fetch(PDO::FETCH_ASSOC)) {
echo ("<div class='letra' align='justify' style='width: 370px;'>
<p><input type='checkbox' name='chk_group[]' id='chk1' value='{$linea['id']}' >
<label class='black-text' for='chk1'>{$linea['nombre_medicamento']}
{$linea['presentacion_medicamento']}</label></p></div>
</div>");
}
}
// END REFERENCE LETTER TO
now in mysql to save it implemented it like this:
<?php
if (isset ($_POST['guardar'])){
$id=$_REQUEST['id'];
$fecha=$_REQUEST['fecha'];
$cedula=$_REQUEST['cedula'];
$idmedicamentos=$_REQUEST['chk_group'];
include("conexion.php");
$sql="SELECT * FROM receta_medica WHERE id='$id' AND fecha='$fecha' AND idmedicamentos='$idmedicamentos[$i]'";
$res=mysql_query($sql,$link);
$nrows=mysql_num_rows($res);
if($nrows==0){
for ($i = 0; $i < count($idmedicamentos); $i++) {
mysql_query("INSERT INTO receta_medica (id,fecha,cedula,idmedicamentos)
VALUES ('$id','$fecha','$cedula','$idmedicamentos[$i]')", $link);
}
echo "<script>alert ('Registro Guardado');</script>
<META HTTP-EQUIV='REFRESH' CONTENT=0;URL=http:recipe_medico.php>";
}
else echo "<div class='registro'><script>alert ('Disculpe, El Paciente ya tiene realizado un recipe para esta Fecha debe Esperar la proxima consulta');</script>
<META HTTP-EQUIV='REFRESH' CONTENT=0;URL=http:recipe_medico.php></div>";
}
?>
as I now use PDO as it might be that I applied the for or that same for me.
<!-- proceso para registrar-->
<?php
if(isset($_POST['guardar'])){
$sql = "SELECT id FROM receta_medica WHERE id = :id LIMIT 1"; //Creamos la select
$check = $DB_con->prepare($sql); //Preparamos la SELECT, de ésta manera evitamos SQL Injection
$check->bindParam(':id', $_POST['id']);//Substituimos las variables de la SELECT
$check->execute();//Ejecutamos la consulta
$contador = $check -> rowCount();//Esta función devuelve el número de resultados que ha devuelto la SELECT
if ($contador > 0) {
$check->closeCursor();
$mensaje = "<div class='col s12 card-panel blue lighten-2 center'>
<h5 class='black-text text-darken-2 center CONDENSED LIGHT5'>
¡ Ups Aviso: El Registro ya se Encuentra Insertado !
</h5>
</div>";
header("refresh:5;examenes_laboratorio.php");
$sql = false;
}else{
$sql=$DB_con->prepare("INSERT INTO receta_medica (id,fk_cedula,fk_examen_laboratorio,fecha)
VALUES (:id, :fk_cedula, :fk_examen_laboratorio[], :fecha)");
$sql->bindParam(':id',$_POST['id']);
$sql->bindParam(':fk_cedula',$_POST['fk_cedula']);
$sql->bindParam(':fk_examen_laboratorio',$_POST['chk_group']);
$sql->bindParam(':fecha',$_POST['fecha']);
$sql->execute();
}
if($sql)
{
$mensaje ="<div class='col s12 card-panel teal lighten-2 center'>
<h5 class='black-text text-darken-2 center CONDENSED LIGHT5'>
¡ Bien Hecho: Registro Insertado Correctamente !
</h5>
</div>";
header("refresh:5;examenes_laboratorio.php");
}
}
?>
<!-- fin proceso para registrar-->