How to stop a return after a function processes (Prevent HTML from not loading)
<p>Hello I have a function that checks if my registration details doesn't match in the database, if it does, then return the code.</p>

<p>But every time I return the code, my HTML won't load because it's stopping it from loading.
I want the HTML to be always under the PHP code, for some specific reason (I want the errors to display up to the form, and not under).</p>

<p>This is an example of my function:</p>

<pre><code>function check_available($name, $password, $email)
{
    global $pdo;

    $check_user = $pdo-&gt;prepare("SELECT * FROM users WHERE user_name = :username LIMIT 1");
    $check_user-&gt;execute( array(':username' =&gt; $name) );        

    $check_email = $pdo-&gt;prepare("SELECT * FROM users WHERE user_email = :email LIMIT 1");
    $check_email-&gt;execute( array(':email' =&gt; $email) ); 

    $error = '';
    if ($check_user-&gt;rowCount())
    {
        $error .= 'Username already exists!';
        return handle_errors($error);
    }
    else if($check_email-&gt;rowCount() &amp;&amp; !$check_user-&gt;rowCount())
    {
        $error .= 'Email already exists!';
        return handle_errors($error);
    }
    else
    {
        return true;
    }
}

    if (isset($_POST['submit']))
    {
        $check_in = check_available($name, $password, $email);


        if ($check_in == true)
        {
            echo 'Created account sucessfully!';
        }
    }
?&gt;  
&lt;html&gt;
&lt;form action="register.php" method="POST"&gt;
Username: &lt;input type="text" name="username"&gt;&lt;br /&gt;
Password: &lt;input type="password" name="password"&gt;&lt;br /&gt;
Email: &lt;input type="text" name="email"&gt;&lt;br /&gt;
&lt;input type="submit" name="submit"&gt;
&lt;/form&gt;
&lt;/html&gt; 
</code></pre>

<p><strong>After submiting, (with having a username that already matches in database), the HTML will hide &amp; error will display.</strong></p>

<p><em>How do I prevent this? is there a trick for that?</em></p>
