i trying to update my database field when form submitted , and then redirect to a page with header function , but page can't redirect and stay . what's the problem ?
session_start();
include("database.php");
if(isset($_POST["submit"])){
$address = $_POST["address"];
$message = $_POST["message"];
$id = $_SESSION["id"];
// custom function
$connect = connectToDatabase();
$database = $connect->prepare("UPDATE users SET address = :address , message = :message WHERE id = :id ");
$database->bindParam(":address", $address);
$database->bindParam(":message", $message);
$database->bindParam(":id", $id);
$success = $database -> execute() ;
if($success){
header("location:../panel/");
exit;
}
}else{
header("location:../panel/");
exit;
}