[Solved] Can’t redirect to another page in PHP


if(!$k)
{
    echo "Koneksi Gagal <br>";
    echo mysqli_errno();
}
else
{   echo "Koneksi Berhasil";
}

Either of your if-else will run and write something to the response.

you can’t redirect after writing the response.

To redirect set header("Location : select.php"); before echo or any other output

solved Can’t redirect to another page in PHP