estoy diseñando un form para actualizar los datos y no me esta extrayendo los datos del usuario al iniciar session para asi poder actualizarlos en la BD.
Lo q deseo hacer es que el usuario pueda editar su perfil personal... pero no me extrae los campos..
aqui dejo ambos codigod
Código PHP:
<?php require_once('conect.php'); ?>
<?php
$rec = "-1";
if (isset($_SESSION['id'])) {
$rec = $_SESSION['id'];
}
$sql="select * from clientes where id = '$rec'";
$sql_exec = mysql_query($sql);
$rec = mysql_fetch_array($sql_exec);
@$status=$_REQUEST['status'];
if ($status==1) {
$msj="Perfil actualizado con éxito!";
}
if ($status==2) {
$msj="- No se pudo procesar su modificación por errores en los cambios realizados";
}?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<link href="../admin/css/estilo.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4"><img src="img_x2/header_x2.jpg" width="600" height="140" /></td>
</tr>
<tr>
<td height="200" rowspan="2" valign="top" background="img_x2/bg_x2.jpg"><table width="140" border="0" align="center" cellpadding="0" cellspacing="3">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="27"><img src="img_x2/home_x2.jpg" width="19" height="19" /></td>
<td width="104" class="textoResto">Inicio</td>
</tr>
<tr>
<td height="5"></td>
<td class="textoResto"></td>
</tr>
<tr>
<td><img src="img_x2/usr_x2.jpg" width="18" height="18" /></td>
<td class="textoResto"><a href="edt_perf_x2.php">Editar Perfil</a></td>
</tr>
<tr>
<td></td>
<td height="5" class="textoResto"></td>
</tr>
<tr>
<td><img src="img_x2/ver_x2.jpg" width="18" height="18" /></td>
<td class="textoResto">Ver facturas</td>
</tr>
<tr>
<td height="5"></td>
<td class="textoResto"></td>
</tr>
<tr>
<td><img src="img_x2/ing_x2.jpg" width="18" height="18" /></td>
<td class="textoResto">Ingresar facturas</td>
</tr>
</table></td>
<td colspan="3"> </td>
</tr>
<tr>
<td width="27"> </td>
<td width="368" align="center" valign="middle" class="textoResto"><form id="form1" name="form1" method="post" action="includes/edita_perfil.php">
<p class="azul_verd_nrm"><strong class="azulgrs_tah"><?=$msj?></strong><br /></p>
<table width="260" border="0" align="center" cellpadding="0" cellspacing="2">
<tr>
<td width="124" class="azulgrs_tah"><div align="right">Nombre: </div></td>
<td width="130" align="center"><label>
<input name="nombre" class="textoTitulos2" value="<?php echo htmlentities ($rec['nombre'], ENT_COMPAT, 'utf-8'); ?>" textype="text" cols="25" rows="5"/>
</label></td>
</tr>
<tr>
<td class="azulgrs_tah"><div align="right">Apellido:</div></td>
<td align="center"><label>
<input name="apellido" class="textoTitulos2" value="<?php echo $rec['apellido']; ?>" textype="text" cols="25" rows="5"/>
</label></td>
</tr>
<tr>
<td class="azulgrs_tah"><div align="right">C.I./RIF.:</div></td>
<td align="center"><input name="cedula" class="textoTitulos2" value="<?php echo $rec['cedula']; ?>" textype="text" cols="25" rows="5"/></td>
</tr>
<tr>
<td class="azulgrs_tah"><div align="right">Teléfono:</div></td>
<td align="center"><label>
<input name="telefono" class="textoTitulos2" value="<?php echo $rec['telefono']; ?>" textype="text" cols="25" rows="5"/>
</label></td>
</tr>
<tr>
<td class="azulgrs_tah"><div align="right">E-Mail:</div></td>
<td align="center"><input name="mail" class="textoTitulos2" value="<?php echo $rec['mail']; ?>" textype="text" cols="25" rows="5"/></td>
</tr>
<tr>
<td class="azulgrs_tah"><div align="right">Fecha de Nacimiento:</div></td>
<td align="center"><input name="fecha" class="textoTitulos2" value="<?php echo $rec['fecha']; ?>" textype="text" cols="25" rows="5"/></td>
</tr>
</table>
<br />
<p align="center">
<label>
<input name="enviar" type="submit" class="textoResto" id="enviar" value="Enviar" />
</label>
</p>
</form></td>
<td width="26" height="200"> </td>
</tr>
<tr>
<td width="179" background="img_x2/bg_x2.jpg"><img src="img_x2/bg_x2.jpg" width="179" height="10" /></td>
<td colspan="3"> </td>
</tr>
<tr>
<td height="8" colspan="4" bgcolor="#E1AE00"></td>
</tr>
</table>
</body>
</html>
Código PHP:
<?php
include ('../conect.php');
$date=date('Y-n-d G:i:s');
extract($_REQUEST);
$nombre = $_REQUEST["nombre"];
$apellido = $_REQUEST["apellido"];
$cedula = $_REQUEST["cedula"];
$telefono = $_REQUEST["telefono"];
$mail = $_REQUEST["mail"];
$fecha = $_REQUEST["fecha"];
if (empty($errores)) {
$sql = "UPDATE info SET
nombre='$nombre',
apellido = '$apellido',
cedula = '$cedula',
telefono = '$telefono',
mail = '$mail',
fecha = '$fecha'";
mysql_query($sql);
header("Location: ../edit_perf_x2.php?status=1");
}
if (!empty($errores)){
header("Location: ../edit_perf_x2?status=2");
}
?>
fijense q extraigo de otra manera en el primer campo pues queria ver si ese era mi error
Código PHP:
<?php echo htmlentities ($rec['nombre'], ENT_COMPAT, 'utf-8'); ?>