Hello, I'm back with another problem that I can't seem to understand. I'm pretty sure that !empty means if something is not empty. But it doesn't seem to work with the way I have it coded out:
$email = $_POST['email'];
$oldpass = md5($_POST['oldpass']);
$password = md5($_POST['pass']);
$password2 = md5($_POST['pass2']);
if($_POST['submit'])
if(!empty($oldpass) && !empty($password) && !empty($password2)) {
$sql = "SELECT password FROM users WHERE username = '".$_SESSION['username']."'";
$res = mysql_query($sql) OR die(mysql_sql());
while($arpass = mysql_fetch_array($res)) {
$old = $arpass['password'];
}
if($oldpass != $old)
echo "<p style='text-align: center'>Invalid Password!</p>";
}
The problem here is that even when the fields are empty it will say "Invalid Password!", though the 2nd if statement says if they are not empty execute the rest. I had echoed $oldpass and I got an md5 text. Which confused me even more as to why an empty field would get encrypted.
I just don't want it to say "Invalid Password!" if you leave it blank. Any help would be greatly appreciated!
Thank You! 🙂
EDIT: I also tried !isset, but that stops the whole if statement for some reason.