Email deleted after database table updates in PHP

I want to update users email from a form in my php page, but after i change the email, php delete it from database, any suggestion?


if (isset($_POST['modify-profile'])) {

    $query = "UPDATE users SET email = '$_SESSION[m_email]' WHERE name ='$_SESSION[name]'";
    $check = $pdo->prepare($query);
    header('Location: ../profile.php');

} else {
    echo "ERROR";

 <form action="php/modify-profile.php" method="POST">
              <input type="email" placeholder="Email:" name="m_email">
              <input type="submit" name="modify-profile">

>Solution :

your question is not clear . did you set $_SESSION[m_email] variable before ? if you didn’t , you have to use $_POST[‘m_email’] instead of that .

Leave a Reply