'How to generate quotes

I'm trying to build a simple quoting tool.

I have a database filled with all the products:

enter image description here

Next, with the following code I generate the PHP page:

<?php

$link = mysqli_connect("localhost", "user", "password", "quote");

echo "<title>Quotes</title>";

// Check connection
if($link === false){
    die("ERROR: Could not connect. " . mysqli_connect_error());
}
$sql = "SELECT * FROM artikelen";
if($result = mysqli_query($link, $sql)){
    if(mysqli_num_rows($result) > 0){
        echo "<table border = 1 padding = 40px>";
            echo "<tr>";
                echo "<th>Aantal</th>";
                echo "<th>ID</th>";
                echo "<th>Categorie</th>";
                echo "<th>Artikel</th>";
                echo "<th>Omschrijving</th>";
                echo "<th>Eenmalig</th>";
                echo "<th>Maandelijks</th>";
                echo "<th>Productcode leverancier</th>";

            echo "</tr>";
        while($row = mysqli_fetch_array($result)){
            echo "<tr>";
                echo "<td><input type='text' name='aantal' id='aantal' value='' maxlength = '4'></td>";
                echo "<td>" . $row['prod_id'] . "</td>";
                echo "<td>" . $row['categorie'] . "</td>";
                echo "<td>" . $row['artikel'] . "</td>";
                echo "<td>" . $row['omschrijving'] . "</td>";
                echo "<td>" . $row['nrc'] . "</td>";
                echo "<td>" . $row['mrc'] . "</td>";
                echo "<td>" . $row['productcode_leverancier'] . "</td>";


            echo "</tr>";
        }
        echo "</table>";
        // Free result set
        mysqli_free_result($result);
    } else{
        echo "No records matching your query were found.";
    }
} else{
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}

// Close connection
mysqli_close($link);
?>

The result is:

enter image description here

So that works. Now, in the first column (Aantal) I want to be able to input the amounts needed. After that, press a button SUBMIT and it should filter out all the lines that don't have something filled in Aantal (Dutch for amount) and at the bottom sum a total NRC and a total MRC so that I have a table left over with only the articles which I've chosen and a total sum at the bottom.

Honestly I don't know how to achieve this? With PHP? Javascript? And how exactly? Can someone please help me?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source