Okay, so as you can see, I made a form. If I put in a name and surname and try to display it afterwards it works, but it goes wrong when I am trying to 'post' it to the database and retrieve it. It gives me a "no result". Since I'm fairly new to this, I don't know what I did wrong. Anyone seeing the problem here?
    //Create connection
    $conn = new mysqli($servername, $username, $password, $dbname);
    //Check connection
    if ($conn->connect_error) {
        die("Connection failed: " . $conn->connect_error);
    }
    echo "<form action='' method='post'>
    Naam: <input type='text' name='name'><br>
    Achternaam: <input type='text' name='surname'><br>
    <input type='submit'>
    </form>";
    $name = $_POST["name"];
    $surname = $_POST["surname"];
    //insert name
    $sql = "INSERT INTO Namen
    VALUES ($name, $surname)";
    $result = $conn->query($sql);
    if(!$result){
     echo "fout ".mysql_error();   
    }
    $sql = "SELECT Voornaam, Achternaam FROM Namen";
    $result = $conn->query($sql);
    echo "<table border='1px'>";
    echo "<th>Naam</th>";
    echo "<th>Achternaam</th>";
    if ($result->num_rows > 0) {
        // output data of each row
        while($row = $result->fetch_assoc()) {
            echo "<tr><td>" .$row["Voornaam"] . "</td>";
            echo "<td>" . $row["Achternaam"] . "</td></tr>";
        }
    } else {
        echo "0 results";
    }
    echo "</table>";
    $conn->close();
    ?>
 
     
    