Este es el codigo que tengo:
info_personal.php:
Código PHP:
<?phpfunction conectarse($host,$usuario,$password,$BBDD){
$link=mysql_connect($host,$usuario,$password) or die (mysql_error());
mysql_select_db($BBDD,$link) or die (mysql_error());
return $link;
}
session_start();
$link=conectarse("localhost","usuario","contraseña","base_datos");
$sql = "select * from clientes, cliente_opciones where clientes.cliente_id = '$_SESSION[cliente]' and cliente_opciones.cliente_id ='$_SESSION[cliente]' ";
$sql = mysql_query($sql, $link);
while($rs=mysql_fetch_array($sql))
{ ?>
<h1>Informacion Personal:</h1>
<form action='configurar.php' method='post'>
<table border='1'>
<tr>
<td></td>
<td></td>
<td>Ocultar</td>
</tr>
<tr>
<td>Nombre:</td>
<td><input name='nombre' type='text' maxlength='25' value='<?php echo $rs['nombre']; ?> '/></td>
<td align="center"><input name="direccion_priv" type="checkbox" <?php if($rs['o_nombre']==1){echo "checked";} ?>></td>
</tr>
<tr>
<td>Apellido:</td>
<td><input name='apellido' type='text' maxlength='25' value='<?php echo $rs['apellido']; ?>'/></td>
<td align="center"><input name="direccion_priv" type="checkbox" <?php if($rs['o_apellido']==1){echo "checked";} ?>></td>
</tr>
</table>
<input name='Registrar' type='submit' value='Guardar'/>
</form>
<?php } ?>
Código PHP:
<?php
session_start();
$con1 = mysql_connect("localhost","usuario","contraseña");
if (!$con1)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("base_datos", $con1);
$sql1="UPDATE clientes SET nombre = '$_POST[nombre]', apellido = '$_POST[apellido]' where cliente_id = '$_SESSION[cliente]'";
if (!mysql_query($sql1,$con1))
{
die('Error: ' . mysql_error());
}
mysql_close($con1);
header ("Location: info_personal.php");
?>
Necesito enviar el valor "1" si esta checkeado o "0" si no lo esta a opciones.php para poder guardarlo en la base de datos.
Alguna idea?
Gracias!