Hola a todos
tengo una consulta con un checkbox para cada registro, hasta aqui correcto.
el problema es que cuando selecciono un checkbox y pulso en editar no me envia el valor del checkbox a la siguiente pagina para poder editarlo. Cual es el error???
<?php
while($row= mysql_fetch_assoc($queEmp)){
echo " <tr>";
echo"<td><input name='checkbox[]' id='checkbox[]' type='checkbox' value='".$row["id"]."'></td><td>".$row['author']."</td>";
echo "<td>".$row['prediccion']."</td>";
echo "<td>".$row['porcentaje']."</td>";
echo "<td>".$row['text']."</td>";
echo " </tr>";
}
} mysql_close($link);
?>
<a href="editar_consejo.php?id=<?php echo $row['id'];?>&action='edit'">Editar</a>
<a href="borrar_consejo.php?id=<?php echo $row['id'];?>&action='edit'">Borrar</a>
-----------------------------------------------------------------
editar_consejo.php
"
if ($action == "edit") {
$check=$_POST['checkbox'];
echo "chechk:".$check[0];
$codigo = sqlValue($_POST["id"], "int");
$author = sqlValue($_POST["author"], "varchar");
$prediccion = sqlValue($_POST["prediccion"], "varchar");
$porcentaje = sqlValue($_POST["porcentaje"], "int");
$text = sqlValue($_POST["text"], "text");
$sql = "UPDATE wp_art_consejos SET ";
$sql.= "author=".$author.",prediccion=".$prediccion.",por centaje=".$porcentaje.",text=".$text." ";
$sql.= "WHERE id=".$id;
mysql_query($sql, $link);
header("location: consulta_consejo.php");
}
$sql = "SELECT * FROM wp_art_consejos WHERE id = ".sqlValue($codigo, "int");
$queEmp = mysql_query($sql, $link);
$row = mysql_fetch_assoc($queEmp);
$total = mysql_num_rows($queEmp);
if ($total == 0) {
header("location: consulta_consejo.php");
exit;
}
?>
Alguien me puede ayudar
Muchas Gracias