I have a question, I have a form where I update the fields of the users the problem is when I want to update the username I update it as root regardless of what you type it always updates it as root.
<form action="ejecutareditar.php" method="POST" role="form">
<legend>Editar Usuarios</legend>
<div class="form-group">
<label for="id">Fecha registro</label>
<input type="text" name="fecha_registro" class="form-control" id="nombre" value="<?php echo $fecha_registro ?>" readonly>
</div>
<div class="form-group">
<label for="id">ID</label>
<input type="text" name="id" class="form-control" id="nombre" value="<?php echo $id ?>">
</div>
<div class="form-group">
<label for="nombre">Nombre</label>
<input type="text" name="nombre" class="form-control" id="email" value="<?php echo $nombre ?>">
</div>
<div class="form-group">
<label for="usuario">Usuario</label>
<input type="text" name="usuario" class="form-control" id="usuario" value="<?php echo $usuario ?>">
</div>
<div class="form-group">
<label for="Email">Email</label>
<input type="email" name="email" class="form-control" required id="email" value="<?php echo $email ?>">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="text" name="password" class="form-control" required id="password" value="<?php echo $password ?>">
</div>
<div class="form-group">
<label for="privilegio">Perfil</label>
<SELECT name="privilegio" size ="1" id="privilegio" style="width:310px " value="<?php echo $privilegio?>">
<option >----Seleccione Perfil----</option>
<option value="1">Administrador</option>
<option value="2">Usuario</option>"
</div></SELECT></div>
<button type="submit" class="btn btn-success">Actualizar</button>
<a href="usuarios.php" title='Editar datos' class='btn btn-danger'>Volver</a>
Code that updates
extract($_POST);
$server = "localhost";
$usuario = "root";
$contraseña = "";
$bd = "bdpagina";
$conexion = mysqli_connect($server, $usuario, $contraseña, $bd)
or die("error en la conexion");
$sentencia ="UPDATE usuarios SET nombre = '$nombre ', usuario = '$usuario', email = '$email', password = '$password', fecha_registro = '$fecha_registro' ,privilegio='$privilegio' WHERE usuarios. id = $id";
$resent=mysqli_query($conexion,$sentencia);
if ($resent==null) {
echo "Error de procesamieno no se han actuaizado los datos";
echo '<script>alert("ERROR EN PROCESAMIENTO NO SE ACTUALIZARON LOS DATOS")</script> ';
header("location: usuarios.php");
echo "<script>location.href='usuarios.php'</script>";
}else {
echo "<script>location.href='usuarios.php'</script>";
}
?>