Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/07/2011, 23:12
jpbadoino
 
Fecha de Ingreso: julio-2011
Mensajes: 9
Antigüedad: 12 años, 9 meses
Puntos: 0
problema con checkbox

Hola, un saludo a todos por acá soy nuevo en el foro y antes de postear leí mucho sobre el tema aun así no puedo solucionarlo, espero me ayuden.
este es mi formulario para modificar los datos de un cliente recupera la información de la bd correctamente, pero al enviar las modificaciones el campo checkbox siempre esta en cero.
modificar.php

Código PHP:
<?php
require_once("conexion.php");
$sql="select * from cliente where idcliente=".$_GET["idcliente"]."";
$res=mysql_query($sql,$con);
?>
<html>
<head>
<title>Modificar Cliente</title>
<script language="javascript" type="text/javascript" src="js/funciones.js"></script>
</head>

<body onLoad="limpiar()">
<?php
if ($reg=mysql_fetch_array($res))

?>
<form action="edit.php" method="post" name="form">
<table align="center" width="400">
<tr>
<td valign="top" align="center" width="400" colspan="2">
<h3>Modificar datos de Cliente</h3>
</td>
</tr>

<tr>
<td align="right" valign="top" width="200">
Nombre
</td>
<td valign="top" align="left" width="200">
<input type="text" name="nom" value="<?php echo $reg["nombre"];?>" />
</td>
</tr>

<tr>
<td align="right" valign="top" width="200">
Direccion
</td>
<td valign="top" align="left" width="200">
<input type="text" name="dir" value="<?php echo $reg["direccion"];?>" />
</td>
</tr>

<tr>
<td align="right" valign="top" width="200">
Tel&eacute;fono
</td>
<td valign="top" align="left" width="200">
<input type="text" name="tel" value="<?php echo $reg["telefono"];?>" />
</td>
</tr>

<tr>
<td align="right" valign="top" width="200">
E-Mail
</td>
<td valign="top" align="left" width="200">
<input type="text" name="mail" value="<?php echo $reg["email"];?>" />
</td>
</tr>

<tr>
<td align="right" valign="top" width="200">
Estado
</td>
<td valign="top" align="left" width="200">
<input type="checkbox" name="est" value="<?php if($reg["estado"]==0){echo ('"0"');$reg["estado"]==0;}else{echo ('"1" checked');$reg["estado"]==1;};?> />
</td>
</tr>

<tr>
<td valign="top" align="center" width="400" colspan="2">
<input type="hidden" name="idcliente" value="<?php echo $_GET["idcliente"];?>">
<input type="button" value="Volver" title="Volver" onClick="history.back();" />
&nbsp;&nbsp;||&nbsp;&nbsp;
<input type="button" value="Modificar" title="Modificar" onClick="validar()" />
</td>
</tr>

</table>
</form>
<?php
}
?>
</body>
</html>

edit.php

Código PHP:
<?php
print_r
($_POST);
require_once(
"conexion.php");

if(
$_POST["est"]==1)
{
   
   
//$_POST['est'];
      
   
$sql="update cliente
set
nombre='"
.$_POST["nom"]."',
telefono='"
.$_POST["dir"]."',
telefono='"
.$_POST["tel"]."',
email='"
.$_POST["mail"]."',
estado='"
.$_POST["est"]."'
where
idcliente="
.$_POST["idcliente"]."";
echo (
$_POST["est"]);
echo(
"estoy en el if con calor 1");
   
}
else
{
       
 
$sql="update cliente
set
nombre='"
.$_POST["nom"]."',
telefono='"
.$_POST["dir"]."',
telefono='"
.$_POST["tel"]."',
email='"
.$_POST["mail"]."',
estado='"
.'0'."'
where
idcliente="
.$_POST["idcliente"]."";
      




//echo $sql;
$res=mysql_query($sql,$con);


?>