Zeigt Fehlermeldung im html-Formular mit php und javascript

Mein html:

<form name="loginForm" method="post" action="login.php" onsubmit="return(validate());" >
    <p><label><b>Username</b></label>
        <input name = "Username" type = "text" maxlength = "30">
    </p>

    <p><label><b>Password</b></label>
        <input name = "Password" type = "text" maxlength = "30">
    </p>
    <p>
        <input type = "submit" value = "Login">
        <input type = "reset" value = "Clear">
        <span class="errorMsg" id="validation"></span>
    </p>
</form>

Mein php-code:

echo " <script type= \'text/javascript\'> 
           document.getElementById('validation').innerHTML = 'Username or Password is Incorrect';
       </script>";

Was ich erreichen will, ist zu zeigen, dass die Fehlermeldung in der Nähe des submit-buttons.

html-und php-codes befinden sich in 2 verschiedenen Dateien.
index.html und login.php beide sind im gleichen Ordner.

Schreibe einen Kommentar