Simple shop database site I'm learning PHP, HTML and SQL - and wondered if anyone could take a look at this code and give me some feedback?

&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;link rel="stylesheet" href="styles.css"&gt;
    &lt;title&gt;Store product information&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;

    &lt;?php

    $host = "localhost";
    $database = "shopDB";
    $username = "root";
    $password = "";

    $conn = new mysqli($host, $username, $password);
    $db_handle = $conn-&gt;select_db($database);

    if ($db_handle)
    {
        if ($_SERVER['REQUEST_METHOD'] == 'POST')
        {
            // Upload to server
            $name = mysqli_real_escape_string($conn, $_POST['name']);
            $quantity = mysqli_real_escape_string($conn, $_POST['quantity']);
            $price = mysqli_real_escape_string($conn, $_POST['price']);
            $description = mysqli_real_escape_string($conn, $_POST['description']);

            $insert_sql = "INSERT INTO products (name, quantity, price, description) VALUES ('$name', '$quantity', '$price', '$description')";
            $insert_result = $conn-&gt;query($insert_sql);

            if ($insert_result)
            {
                // Uploaded successfully
            } else {
                print mysqli_error($conn);
            }
        }

        $products_sql = "SELECT
                           products.name,
                           products.quantity,
                           products.price,
                           products.description
                         FROM products";
        $products_result = $conn-&gt;query($products_sql);

        if ($products_result)
        {
            print "&lt;table id='products_table'&gt;";

            print "&lt;thead&gt;";
            print "&lt;tr&gt;";
            print "&lt;th&gt;Name&lt;/td&gt;";
            print "&lt;th&gt;Quantity&lt;/td&gt;";
            print "&lt;th&gt;Price&lt;/td&gt;";
            print "&lt;th&gt;Description&lt;/td&gt;";
            print "&lt;/tr&gt;";
            print "&lt;/thead&gt;";

            print "&lt;tbody&gt;";
            while ($db_field = mysqli_fetch_assoc($products_result))
            {
                print "&lt;tr&gt;";
                print "&lt;td&gt;" . $db_field['name'] . "&lt;/td&gt;";

                if ($db_field['quantity'] == '0') {
                    print "&lt;td class='out_of_stock_cell'&gt;" . $db_field['quantity'] . "&lt;/td&gt;";
                } else {
                    print "&lt;td&gt;" . $db_field['quantity'] . "&lt;/td&gt;";
                }

                print "&lt;td&gt;" . $db_field['price'] . "&lt;/td&gt;";
                print "&lt;td&gt;" . $db_field['description'] . "&lt;/td&gt;";
                print "&lt;tr&gt;";
            }
            print "&lt;/tbody&gt;";
            print "&lt;/table&gt;";
        }
    }

    ?&gt;

    &lt;h3 id="insert_items_header"&gt;Insert items&lt;/h3&gt;
    &lt;form action="index.php" method="post"&gt;
        &lt;table&gt;
            &lt;thead&gt;
                &lt;th&gt;Name&lt;/th&gt;
                &lt;th&gt;Quantity&lt;/th&gt;
                &lt;th&gt;Price&lt;/th&gt;
                &lt;th&gt;Description&lt;/th&gt;
            &lt;/thead&gt;
            &lt;tbody&gt;
                &lt;td&gt;&lt;input name="name" type="text"&gt;&lt;/input&gt;&lt;/td&gt;
                &lt;td&gt;&lt;input name="quantity" type="text"&gt;&lt;/input&gt;&lt;/td&gt;
                &lt;td&gt;&lt;input name="price" type="text"&gt;&lt;/input&gt;&lt;/td&gt;
                &lt;td&gt;&lt;input name="description" type="text"&gt;&lt;/input&gt;&lt;/td&gt;
            &lt;/tbody&gt;
        &lt;/table&gt;
    &lt;br&gt;
    &lt;input id="submit_button" type="submit" value="Register item"&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;


Database structure:
Security

XSS

You might want to consider HTML encoding the database values such as product name, description, price, etc. 

It may or may not be needed currently, but generally, you might want more than one type of user in the future. You may have a site admin, a sales manager, data entry people who add new products, and so on. 

If you do not encode these values, less privileged users could escalate their privileges via XSS.

CSRF

You also do not have any CSRF protection. This means that an attacker can add products if a logged in user with the right to add products visits an attacker-controlled website.

As you are also open to XSS, an attacker can gain XSS via adding products.

SQL Injection

Escaping is really not the preferred way to defend against SQL Injection. It's certainly a lot better than nothing, and if used correctly will be secure, but in practice, prepared statements result in better and more secure code and are really the only correct way to handle SQL Injections.

Structure

Your code is generally quite readable, but it would be even more readable if you would separate code into classes and functions. This would also make adding new functionality a lot easier

For later exercises, you might want to look into MVC. But even for a small example script, you might want to at least separate the database connection , so in case the credentials change, you do not have to change them all over the place, but just in one configuration file.

Functions would help make your code even more readable. You might consider functions such as selectProductById($connection, $id), insertProduct($connection, $name, $description, $price, $quantity), showProducts($products), showProductForm etc. You might also consider extracting those methods in a separate Product class (or a Product class for the database interactions, and a ProductView class for the displaying functions).

Misc


why are all your inputs of type text? Quantity and Price should be numbers, allowing a user to enter anything makes for bad usability. In practice, description should also likely be a textarea.
having an empty if is bad for readability. Just negate the question and only have the else case.
regarding usability: Think about adding at least some kind of feedback after a successful add.