I'm trying this:
<?php
session_start();
require 'conexion.php';
$nombre = $_POST['nombre'];
$emai = $_POST['emai'];
$pass = $_POST['pass'];
$tel = $_POST['tel'];
$dir = $_POST['dir'];
$id = $_SESSION['usuario']['ID'];
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Oops: " . $conn->connect_error);
}
if (isset($_SESSION['usuario'])) {
$cambio = "UPDATE Usuarios SET name='$nombre', email='$emai', password='$pass', phone='$tel', address='$dir' WHERE ID='$id'";
if (($result=$conn->query($cambio)) === true) {
echo $_SESSION['usuario']['name'];
} else {
echo "Error: ";
}
} else {
echo"oops";
}
$conn->close();
?>
With this form:
<form action="vcambio.php" method="post">
<div class="group">
<input type="text" name="nombre" required>
<span class="highlight"></span>
<span class="bar"></span>
<label>cambiar nombre</label>
</div>
<div class="group">
<input type="email" name="emai" required>
<span class="highlight"></span>
<span class="bar"></span>
<label>Cambiar Email</label>
</div>
<div class="group">
<input type="password" name="pass" required>
<span class="highlight"></span>
<span class="bar"></span>
<label>Cambiar Contraseña</label>
</div>
<div class="group">
<input type="text" name="tel" required>
<span class="highlight"></span>
<span class="bar"></span>
<label>Cambiar Telefono</label>
</div>
<div class="group">
<input type="text" name="dir" required>
<span class="highlight"></span>
<span class="bar"></span>
<label>Cambiar direccion</label>
</div>
<input type="submit" name="sumbitt" value="Guardar Cambios"</input>
</form>
<?php
if (isset($_POST['submitt'])) {
require ("vcambio.php");
}
?>
I can not find the error when I execute it. Print the variables from the previous session. It does not throw me error but it does not update the variables, when I consult it in phpmyadmin
it follows the same as before.