PHP Echo to a certain part of HTML
<p>I recently finished my login system but I have a question about PHP. How can I echo text or html to a certain part of html?</p>

<p>For example. Lets say the code below is all inside one PHP file. How could I echo the 2 echos in the php code to the html where the comment is?</p>

<p>So if I were to display this page and if their login failed it would echo "The username and password you entered did not match our records. Please double-check and try again." to that comment in the html.</p>

<p>I hope that makes sense, Thanks!</p>

<pre><code>&lt;?php
    session_start();

    if (isset($_POST['username']) &amp;&amp; isset($_POST['password'])) {
        include_once("db.php");
        $username = mysqli_real_escape_string($sqlcon, $_POST['username']);
        $username = strtoupper($username);
        $password = mysqli_real_escape_string($sqlcon, $_POST['password']);

        for ($i = 0; $i &lt; 1000; $i++) {
            $password = hash(sha512, $password . $username);
        }

        $userQuery = "SELECT * FROM users WHERE username = '" . $username . "' LIMIT 1";
        $user = mysqli_query($sqlcon, $userQuery);

        if (mysqli_num_rows($user) &gt; 0) {
            $user = mysqli_fetch_assoc($user);
            $id = $user['id'];
            $databasepass = $user['password'];

            if ($password === $databasepass) {
                $_SESSION['username'] = $username;
                $_SESSION['id'] = $id;
                header("Location: admin.php");
            } else {
                echo "The username and password you entered did not match our records. Please double-check and try again.";
            }
        } else {
            echo "The username and password you entered did not match our records. Please double-check and try again.";
        }
    }
?&gt;

&lt;!DOCTYPE html&gt;
&lt;html&gt;
    &lt;head&gt;
        &lt;title&gt;ADMIN&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;div&gt;
            &lt;!--ECHO THOSE TWO ECHOS ABOVE HERE--&gt;
        &lt;/div&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>