buenas tengo un problema para editar la tabla usuarios le he dado vueltas a la cuestión y nada que me modifica los datos, nose se que podria hacer....
nose si me envian un link de un ejemplo de como modificar los datos...
este es el formulario llamado usuarios_edit.php me redirige a la pagina accion_usuarios_edit.php
Código PHP:
<?php
$strCodigo = $_GET['codigo'];
$strQuery ="SELECT * FROM usuarios1 WHERE id_u='$strCodigo'";
$strResultado = mysql_query($strQuery) or die(mysql_error());
while ($DatSol = mysql_fetch_array($strResultado)) {
//Datos de la planilla
$strCed = $DatSol['cedula_u'];
$strApe = $DatSol['apellido_u'];
$strNom = $DatSol['nombre_u'];
$strLog = $DatSol['login_u'];
$strNiv = $DatSol['nivel_u'];
$strCda = $DatSol['cdarea'];
$strTelf = $DatSol['telefono_u'];
$strProf = $DatSol['profesion_u'];
$strCiv = $DatSol['civ_u'];
}
?>
<table width="960" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="36" colspan="3" class="titulo_bar"> USUARIOS </td>
</tr>
<tr>
<td width="74"> </td>
<td width="813" height="903" valign="top"><div align="center">
<form action="../sistema/principal1.php?sitio=accion_usuario_edit" method="post" enctype="multipart/form-data" name="usuario" id="usuario">
<table width="511" border="0" cellspacing="2" cellpadding="2">
<tr>
<td height="25" colspan="2" bgcolor="#990000" class="tituloform">Datos Personales </td>
</tr>
<tr>
<td class="label_form">Cedula:</td>
<td> <input name="codigo" type="hidden" id="codigo" maxlength="8" value="<?php echo $strCodigo; ?>"/>
<input name="cedula_u" type="text" id="cedula_u" maxlength="8" value="<?php echo $strCed; ?>" placeholder="11111111" /></td>
</tr>
<tr>
<td class="label_form">Apellidos:</td>
<td><input name="apellido_u" type="text" id="apellido_u" maxlength="20" value="<?php echo $strApe; ?>"/></td>
</tr>
<tr>
<td width="339" class="label_form">Nombres:</td>
<td width="358"><input name="nombre_u" type="text" id="nombre_u" maxlength="20" value="<?php echo $strNom; ?>"/></td>
</tr>
<tr>
<td width="339" class="label_form">Telefono:</td>
<td width="358"><select name="cdarea" id="cdarea" readonly="true">
<?php
switch ($strCda){
case "0414": ?>
<option value="0414" selected="selected">0414</option>
<option value="0424">0424</option>
<option value="0416">0416</option>
<option value="0426">0426</option>
<option value="0412">0412</option>
<option value="0274">0274</option>
<?php break; case "0424": ?>
<option value="0414">0414</option>
<option value="0424" selected="selected">0424</option>
<option value="0416">0416</option>
<option value="0426">0426</option>
<option value="0412">0412</option>
<option value="0274">0274</option>
<?php break; case "0416": ?>
<option value="0414">0414</option>
<option value="0424">0424</option>
<option value="0416" selected="selected">0416</option>
<option value="0426">0426</option>
<option value="0412">0412</option>
<option value="0274">0274</option>
<?php break; case "0426": ?>
<option value="0414">0414</option>
<option value="0424">0424</option>
<option value="0416">0416</option>
<option value="0426" selected="selected">0426</option>
<option value="0412">0412</option>
<option value="0274">0274</option>
<?php break; case "0412": ?>
<option value="0414">0414</option>
<option value="0424">0424</option>
<option value="0416">0416</option>
<option value="0426">0426</option>
<option value="0412" selected="selected">0412</option>
<option value="0274">0274</option>
<?php break; case "0274": ?>
<option value="0414">0414</option>
<option value="0424">0424</option>
<option value="0416">0416</option>
<option value="0426">0426</option>
<option value="0412">0412</option>
<option value="0274" selected="selected">0274</option>
<?php break; case "": ?>
<option value="0414">0414</option>
<option value="0424">0424</option>
<option value="0416" selected="selected">0416</option>
<option value="0426">0426</option>
<option value="0412">0412</option>
<option value="0274">0274</option>
<?php break; } ?>
</select>
<input name="telefono_u" type="text" id="telefono_u" size="9" maxlength="7" value="<?php echo $strTelf; ?>"/>
</td>
</tr>
<tr>
<td width="339" class="label_form">Profesion:</td>
<td width="358">
<select name="profesion_u" id="profesion_u" class="cajatx">
<?php
switch ($strProf){
case "INGENIERO CIVIL": ?>
<option value="INGENIERO CIVIL" selected="selected">INGENIERO CIVIL</option>
<option value="ARQUITECTO">ARQUITECTO</option>
<option value="TSU CONST. CIVIL">TSU CONST. CIVIL</option>
<?php break; case "ARQUITECTO": ?>
<option value="INGENIERO CIVIL">INGENIERO CIVIL</option>
<option value="ARQUITECTO" selected="selected">ARQUITECTO</option>
<option value="TSU CONST. CIVIL">TSU CONST. CIVIL</option>
<?php break; case "TSU CONST. CIVIL ": ?>
<option value="INGENIERO CIVIL">INGENIERO CIVIL</option>
<option value="ARQUITECTO">ARQUITECTO</option>
<option value="TSU CONST. CIVIL" selected="selected">TSU CONST. CIVIL</option>
<?php break; case "": ?>
<option value="INGENIERO CIVIL" selected="selected">INGENIERO CIVIL</option>
<option value="ARQUITECTO">ARQUITECTO</option>
<option value="TSU CONST. CIVIL">TSU CONST. CIVIL</option>
<?php break; } ?>
</select>
</td>
</tr>
<tr>
<td width="339" class="label_form">CIV:</td>
<td width="358"><input name="civ_u" type="text" id="civ_u" value="<?php echo $strCiv; ?>"/></td>
</tr>
<tr>
<td height="25" colspan="2" bgcolor="#990000" class="tituloform">Datos Login </td>
</tr>
<tr>
<td class="label_form">Usuario:</td>
<td><input name="login_u" type="text" id="login_u" value="<?php echo $strLog; ?>" /></td>
</tr>
<tr>
<td class="label_form">Clave:</td>
<td><input name="cla_usr" type="text" id="cla_usr"/></td>
</tr>
<tr>
<td class="label_form">Nivel:</td>
<td><select name="nivel_u" class="texto_input" id="nivel_u" readonly="true">
<?php
switch ($strNiv){
case "1": ?>
<option value="1" selected="selected">ADMINISTRADOR</option>
<option value="2">INSPECTOR</option>
<option value="3">BASICO</option>
<?php break; case "2": ?>
<option value="1">ADMINISTRADOR</option>
<option value="2" selected="selected">INSPECTOR</option>
<option value="3">BASICO</option>
<?php break; case "3": ?>
<option value="1">ADMINISTRADOR</option>
<option value="2">INSPECTOR</option>
<option value="3" selected="selected">BASICO</option>
<?php break; case "": ?>
<option value="1" selected="selected">ADMINISTRADOR</option>
<option value="2">INSPECTOR</option>
<option value="3">BASICO</option>
<?php break; } ?>
</select></td>
</tr>
<tr>
<td colspan="2"> <div class="siguiente">
<input name="Enviar" type="submit" value="Siguiente"/>
<input name="Restablecer" type="reset" value="Restablecer"/>
</div></td>
</tr>
</table>
</form>
<p><br/>
</p>
</div></td>
<td width="74" background="../img/dr_a.jpg"> </td>
</tr>
<tr>
<td height="27" colspan="3" background="../img/foot_admin.jpg"> </td>
</tr>
</table>
y este es el archivo accion_usuarios_edit
Código PHP:
<?php
$strAcceso = 5;
$codigo = $_GET['codigo'];
$strCed = $_POST['cedula_u'];
$strApe = $_POST['apellido_u'];
$strNom = $_POST['nombre_u'];
$strUsu = $_POST['login_u'];
$strCla = md5($_POST['cla_usr']);
$strNiv = $_POST['nivel_u'];
$strCdarea =$_POST['cdarea'];
$strTelf = $_POST['telefono_u'];
$strProf = $_POST['profesion_u'];
$strCiv = $_POST['civ_u'];
$strQuery = "update usuarios1 set cedula_u='$strCed',apellido_u='$strApe',nombre_u='$strNom',login_u='$strUsu',password_u='$strCla',ultimo_acs_u='$strAcceso',nivel_u='$strNiv',cdarea='$strCdarea',telefono_u='$strTelf',profesion_u='$strProf',civ_u='$strCiv' WHERE id_u='$codigo'";
$strResult = mysql_query($strQuery) or die(mysql_error());
echo "el usuario fue modificado";
?>