I have this chunk of code:
<form action="register.php" method="post">
Email: <input type="text" name="email" /><br />
Username: <input type="text" name="username" /><br />
Password: <input type="password" name="p" id="password" /><br />
<input type="button" value="Register" onclick="formhash(this.form, this.form.password);" />
</form>
As you can see, when the button is clicked, a function gets called which encrypts the password. My problem is that I can't check if the user even wrote anything in the password field because the encryption encrypts the password before I can check it. I usually check it like this:
<?php if (empty($_POST['password'])) {
echo "You forgot to fill the password field.";
}
But the password field is filled no matter what, because of the encryption. I need something that can check if the password field is empty before the button where the password gets encrypted is pressed... Any ideas?