Ver Mensaje Individual
  #15 (permalink)  
Antiguo 02/10/2006, 09:09
Avatar de Erikfrancisco
Erikfrancisco
 
Fecha de Ingreso: noviembre-2003
Ubicación: Estado de México
Mensajes: 503
Antigüedad: 21 años, 2 meses
Puntos: 4
Bueno despues de que me diste la estructura de tu tabla creo que ahora sí nos sintonizamos en el mismo canal ya hice las pruebas y ya funciona bueno eso es lo que creo checalo y modificalo para que se vea más bonito ¿no? aquí esta el código:

Código PHP:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head> 
<title>Documento sin t&iacute;tulo</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<style type="text/css"> 
<!-- 
.Estilo3 {color: #FF0000} 
--> 
</style> 
</head> 
<body> 

<?php
$db mysql_connect'localhost''''' ) or die ( "Unable to connect to MySQL server." ); 
$datos mysql_select_db 'proyectodb'$db ); 

if ( isset ( 
$_POST['submit'] ) )
{
$consulta "UPDATE usuario SET ";
$consulta .= "codver = '".$_POST['codver']."',";
$consulta .= "email = '".$_POST['email']."',";
$consulta .= "sexo = '".$_POST['sexo']."',";
$consulta .= "nombre = '".$_POST['nombre']."',";
$consulta .= "apepat = '".$_POST['apepat']."',";
$consulta .= "apemat = '".$_POST['apemat']."',";
$consulta .= "dni = '".$_POST['dni']."',";
$consulta .= "telefo = '".$_POST['telefo']."',";
$consulta .= "dire = '".$_POST['dire']."',";
$consulta .= "cuidad = '".$_POST['cuidad']."',";
$consulta .= "provin = '".$_POST['provin']."',";
$consulta .= "depa = '".$_POST['depa']."',";
$consulta .= "insti = '".$_POST['insti']."',";
$consulta .= "cargo = '".$_POST['cargo']."',";
$consulta .= "como = '".$_POST['como']."'";
$consulta .= " WHERE codmod = '".$_POST['codmod']."'";
$result mysql_query $consulta );

$consulta3 "SELECT * FROM usuario WHERE codmod = '".$_POST['codmod']."'";
$result3 mysql_query $consulta3 );
$fila mysql_fetch_array $result3 );

echo 
"El registro fue actualizado y ahora contiene los siguientes datos:<br/>";
echo 
"<input type = 'text' name = 'usuario' value = '".$fila['usuario']."'><br/>";
echo 
"<input type = 'text' name = 'codver' value = '".$fila['codver']."'><br/>";
echo 
"<input type = 'text' name = 'email' value = '".$fila['email']."'><br/>";
echo 
"<input type = 'text' name = 'sexo' value = '".$fila['sexo']."'><br/>";
echo 
"<input type = 'text' name = 'nombre' value = '".$fila['nombre']."'><br/>";
echo 
"<input type = 'text' name = 'apepat' value = '".$fila['apepat']."'><br/>";
echo 
"<input type = 'text' name = 'apemat' value = '".$fila['apemat']."'><br/>";
echo 
"<input type = 'text' name = 'dni' value = '".$fila['dni']."'><br/>";
echo 
"<input type = 'text' name = 'telefo' value = '".$fila['telefo']."'><br/>";
echo 
"<input type = 'text' name = 'dire' value = '".$fila['dire']."'><br/>";
echo 
"<input type = 'text' name = 'cuidad' value = '".$fila['cuidad']."'><br/>";
echo 
"<input type = 'text' name = 'provin' value = '".$fila['provin']."'><br/>";
echo 
"<input type = 'text' name = 'depa' value = '".$fila['depa']."'><br/>";
echo 
"<input type = 'text' name = 'insti' value = '".$fila['insti']."'><br/>";
echo 
"<input type = 'text' name = 'cargo' value = '".$fila['cargo']."'><br/>";
echo 
"<input type = 'text' name = 'como' value = '".$fila['como']."'>";

mysql_free_result $result3 );
}

else
{
$usuario "Admin";
$consulta2 "SELECT * FROM usuario WHERE usuario = '".$usuario."'"
$result2 mysql_query $consulta2$db ) or die ( header ("No se pudo realizar la consulta" ) );
$fila2 mysql_fetch_array $result2 );
?>
<form name = "formu" action = "<?php $_SERVER['PHP_SELF']; ?>" method="post" > 
<div align="center"> 
<table border="1">
<tr> 
<td width="201">Cod Ver </td> 
<td><input name="codver" type="text" readonly="true" value= "<?php echo $fila2['codver']; ?>">
                   <input name="codmod" type="hidden" readonly="true" value= "<?php echo $fila2['codmod']; ?>"></td> 
</tr> 
<tr> 
<td>Email</td> 
<td><span class="Estilo3"> 
<input name="email" type="text" size="50" value= "<?php echo $fila2['email']; ?>"></span>
</td> 
</tr> 
<tr> 
<td>Sexo</td> 
<td><label> 
<input name="sexo" type="radio" value = "hombre" <?php if ( $fila2['sexo'] == 'hombre' ) echo "checked"?>
Hombre</label> 
<input name="sexo" type="radio" value = "mujer" <?php if ( $fila2['sexo'] == 'mujer' ) echo "checked"?>
Mujer</td> 
</tr> 
<tr> 
<td>Nombres</td> 
<td><span class="Estilo3"> 
<input name="nombre" type="text" id="nombre" readonly="true" size="50" value= "<?php echo $fila2['nombre']; ?>" > 
</span></td> 
</tr> 
<tr> 
<td>Apellido Parterno </td> 
<td><span class="Estilo3"> 
<input name="apepat" type="text" readonly="true" size="35" value= "<?php echo $fila2['apepat']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td>Apellido Materno </td> 
<td><span class="Estilo3"> 
<input name="apemat" type="text" readonly="true" size="35" value = "<?php echo $fila2['apemat']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td>DNI</td> 
<td><span class="Estilo3"> 
<input name="dni" type="text" size="8" value= "<?php echo $fila2['dni']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td>Telefonos:</td> 
<td><span class="Estilo3"> 
<input name="telefo" type="text" id="telefono" size="35" value = "<?php echo $fila2['telefo']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td>Direccion</td> 
<td><span class="Estilo3"> 
<input name="dire" type="text" id="direccion" size="50" value = "<?php echo $fila2['dire']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td>Cuidad</td> 
<td><span class="Estilo3"> 
<input name="cuidad" type="text" size="30" value = "<?php echo $fila2['cuidad']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td>Provincia</td> 
<td><span class="Estilo3"> 
<input name="provin" type="text" id="provincia" size="30" value = "<?php echo $fila2['provin']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td>Departamento:</td> 
<td><span class="Estilo3"> 
<input name="depa" type="text" id="departamento" size="30" value = "<?php echo $fila2['depa']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td colspan="2">De la institucion</td> 
</tr> 
<tr> 
<td>Instituxcion Proveniente </td> 
<td><span class="Estilo3"> 
<input name="insti" type="text" id="institucion" size="50" value = "<?php echo $fila2['insti']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td>Cargo</td> 
<td><span class="Estilo3"> 
<input name="cargo" type="text" id="cargo" size="50" value = "<?php echo $fila2['cargo']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td>Otro</td> 
<td>&nbsp;</td> 
</tr> 
<tr> 
<td>Como se entero </td> 
<td><span class="Estilo3"> 
<input name="como" type="text" id="como" size="50" value = "<?php echo $fila2['como']; ?>"> 
</span></td> 
</tr> 
<tr> 
<td colspan="2" align = "right"><input type = "submit" name = "submit" value = "Actualizar"></td>
</tr>
</table>
</div>
</form>
<?php
mysql_free_result 
$result2 );
}
?>
Suerte

Última edición por Cluster; 02/10/2006 a las 09:17