My header location doesn't works, in my wampserver it works, when I put it in my server, it doesn't, any Ideas?
If I put a echo instead of the header, it works fine.
<html>
    <head>
        <meta charset="utf-8">
        <title>Login</title>
        <link rel="stylesheet" href="css/login.css" />
    </head>
    <body>
    <?php
        require('db.php');
        session_start();
        // If form submitted, insert values into the database.
        if (isset($_POST['username'])){
            $username = $_POST['username'];
            $password = $_POST['password'];
            $username = stripslashes($username);
            $username = mysqli_real_escape_string($connection, $username);
            $password = stripslashes($password);
            $password = mysqli_real_escape_string($connection, $password);
            $query = "SELECT * FROM `users` WHERE username='$username' and password='$password'";
            $result = mysqli_query($connection, $query) or die(mysql_error());
            $rows = mysqli_num_rows( $result);
            if($rows==1){
                $_SESSION['username'] = $username;
                header("Location: welkom.php");
            }else{
                echo "<div id='cancel'><h3>Username/password is incorrect.</h3><br/>Click here to <a href='index.php'>try again</a></div>";
            }
        }else{   
    ?>
    <div id="login">
        <div id="triangle"></div>
        <h1>Log in</h1>
        <form action="" method="POST" name="login">
            <input type="text" name="username" placeholder="Username" required />
            <input type="password" name="password" placeholder="Password" required />
            <input name="submit" type="submit" value="login" />
        </form>
    </div>
    <?php } ?>
    </body>
</html>
 
     
     
     
     
    