Skip to content
Advertisement

PHP echo not returning
correctly

Can someone tell me why the <?php echo $userPasswordError; ?> line returns nothing (empty) instead of <div class="invalid-feedback">Too long.</div> when I enter a password which contain more than 1 character with the below code ?

If I change this line : $userPasswordError = '<div class="invalid-feedback">Too long.</div>';

with this $userPasswordError = 'Too long.'; , it works ! Output is “Too long.”.

JavaScript

Advertisement

Answer

I finally know why.

JavaScript

The variable name of isvalidOrInvalidUserPasword is wrong, it should be $isvalidOrInvalidUserPassword (missing an s at Pasword).

If the input does not have class is-invalid, the error message will not visible!

Hope this helps!

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement