salve sto tentando di aggiornare il profilo utente ma mi da errore nel else chiedo aiuto grazie
Codice:
<?php
session_start();
# check if the user is logged in
if(isset($_POST['submit'])){
# database connection file
include 'app/db.conn.php';
# get the logged in user's username from SESSION
$user_id = $_SESSION['user_id'];
$username = $_POST['username'];
$email = $_POST['email'];
$sql = "UPDATE users SET username=?, email=? WHERE user_id=?";
$stmt= $conn->prepare($sql);
$stmt->execute([$username, $email, $user_id]);
{
}else { //qui da errore
header("Location: profilo.php");
exit;
}
?>
---------------------------------------
<form method="post" action="updateuser.php" >
<!-- Form Group (username)-->
<div class="mb-3">
</div>
<!-- Form Row-->
<div class="row gx-3 mb-3">
<!-- Form Group (first name)-->
<div class="col-md-6">
</div>
<!-- Form Group (last name)-->
<div class="col-md-6">
<label class="small mb-1" for="inputLastName"></label>
</div>
</div>
<!-- Form Row -->
<div class="row gx-3 mb-3">
</div>
<!-- Form Group (email address)-->
<div class="mb-3">
<label class="small mb-1" for="inputEmailAddress">username</label>
<input type="text" class="form-control" name="username" style="width:20em;" placeholder="Username" value="<?=$user['username']?>" required />
</div>
<div class="mb-3">
<label class="small mb-1" for="inputEmailAddress">Tua email</label>
<input type="text" class="form-control" name="email" style="width:20em;" placeholder="Email" value="<?=$user['email']?>" required />
</div>
<!-- Form Row-->
<div class="row gx-3 mb-3">
</div>
<!-- Save changes button-->
<input type="submit" name="submit" value="Aggiorna" />
</form>