I have html and php code and database and php code to connect the database. When I make the register page the code working, and data can be saved into the database. but when I made the login page, after I input username and password the page can't change to another page, and the browser don't show any error in code
login.php file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="css/log.css">
<style>
body {
background: url("img/caption.jpg");
background-size: cover;
}
</style>
<title>doc</title>
</head>
<body>
<header>
<!--set nav or another header here-->
<h1 id="Great" align="center">Welcome Ambarawa Classsic Train Trip </h1>
</header>
<!--set main content between header and footer-->
<div class="Container">
<div class="log">
<div class="title">
<h3 id="setTitle">Login</h3>
</div>
<div class="contenbox">
<form action="utama.php" method="post">
<label for="user" style="font-family: serif;">Username:</label> <br> <input type="email" name="username" id="user" placeholder="username"><br>
<br>
<label for="passwordu" style="font-family: serif;">Password:</label> <br> <input type="password" name="userpassword" id="passwordu" placeholder="password"><br>
<!--<input type="submit" value="Login" id="send">-->
<input type="submit" value="login" name="excecution" id="ss">
</form>
</div>
<a href="forget.html" id="forget">Forgot password</a>
</div>
<div class="foot`">
<p>don't have any account? <a href="regis.php" id="new">sign up here</a></p>
</div>
</div>
<script src="tag.js"></script>
</body>
</html>
<?php
include "db.php";
if($_SERVER['REQUEST_METHOD'] == 'POST'){//requst method
$id= isset($_POST['username']) ? $_POST['username'] :'';
$pas=isset($_POST['userpassword']) ? $_POST['userpassword'] :'';
if(isset($_POST['execution'])==true){
$capture= "SELECT * FROM penguna WHERE Email='$id' AND pass='$pas'";
$result = mysqli_query($con,$capture);
if($result>0){
$kolom=mysqli_fetch_assoc($result);
$_SESSION['masuk'] = true;
header("Location:utama.php");
}
}
}
?>
and this's terget code name is utama.php
<?php
session_start();
if (isset($_SESSION['masuk']) && $_SESSION['masuk'] ==true){
echo"wellcomme";
}
else{
header("Location:login.php");
}
?>
<!doctype html>
<html lang="en">
<head>
<title>Title</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS v5.2.1 -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
</head>
<body>
<button class="btn btn-primary" type="button" data-bs-toggle="offcanvas" data-bs-target="#slide" aria-controls="Id1">Enable both scrolling & backdrop</button>
<div class="offcanvas offcanvas-start bg-dark text-light" data-bs-scroll="true" tabindex="-1" id="slide" aria-labelledby="Enable both scrolling & backdrop">
<div class="offcanvas-header">
<h5 class="offcanvas-title" id="Enable both scrolling & backdrop">welcome</h5>
<button type="button" class="btn btn-close bg-danger" data-bs-dismiss="offcanvas" aria-label="Close"></button>
</div>
<div class="offcanvas-body">
<p>Try scrolling the rest of the page to see this option in action.</p>
</div>
</div>
<br>
<div class="catch">
<form action="" method="get">
<input type="text" placeholder="Judul">
<textarea name="" id="" cols="30" rows="10" placeholder="Diskusi"></textarea>
<input type="submit" value="+">
</form>
</div>
<!-- Bootstrap JavaScript Libraries -->
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"
integrity="sha384-oBqDVmMz9ATKxIep9tiCxS/Z9fNfEXiDAYTujMAeBAsjFuCZSmKbSSUnQlmh/jp3" crossorigin="anonymous">
</script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/js/bootstrap.min.js"
integrity="sha384-7VPbUDkoPSGFnVtYi0QogXtr74QeVeeIs99Qfg5YCF+TidwNdjvaKZX19NZ/e6oz" crossorigin="anonymous">
</script>
</body>
</html>