title: SYNTAX ERROR ON my account_settings.php
body: <p>I am following an online tutorial. The problem is I am getting</p>
  
  <blockquote>
    <p>syntax error unexpected T_ELSE PHP white-space on the second last else.</p>
  </blockquote>
  
  <p>I have tried to sort the PHP white-space using notepad++ but it's not going away.Am currently using PHP 8. Where might the error be originating from?</p>
  
  <p>This is my account_settings.php page:</p>
  
  <pre><code>&lt;?php
  include( "header inc.php" ); 
  if (!$user) {
  
  }
  else
  {
   die ("You must be logged in to view this page!");
  }
  ?&gt;
  &lt;?php
  $senddata = @$_POST['senddata'];
  
  //Password variables
    $old_password = mysqli_real_escape_string($mysqli,@$_POST['oldpassword']);
    $new_password = mysqli_real_escape_string($mysqli,@$_POST['newpassword']);
    $repeat_password = mysqli_real_escape_string($mysqli,@$_POST['newpassword2']);
  if ($senddata) 
      //If the form is submitted..
  
       $password_query = $mysqli-&gt;query("SELECT * FROM users WHERE username='$user'");
    while ($row = mysqli_fetch_assoc($password_query)) {
          $db_password = $row['password'];
  
          //md5 the old password before we check if it matches
          $old_password_md5 = md5($old_password);
  
          //Check whether old password equals $db_password
          if ($old_password_md5 == $db_password) {
           //Continue Changing the users password ...
           //Check whether the 2 new passwords match
           if ($new_password == $repeat_password) {
  
              //md5 the new password before we add it to the database
              $new_password_md5 = md5($new_password);
             //Great! Update the users passwords!
             $password_update_query = $mysqli-&gt;query("UPDATE users SET password='$new_password_md5' WHERE username='$user'");
             echo "Success! Your password has been updated!"; 
             }
             }
             else
             {
              echo "Your two new passwords don't match!";
              }
              }
              else
              {
                  echo "The old password is incorrect!";
                  }
                  }
                  else
                  {
                      echo "";
                      }
  
  ?&gt;
  &lt;h2&gt;Edit your Account Settings below&lt;/h2&gt;
  &lt;hr /&gt; 
  &lt;form action="account_settings.php" accept-charset="utf-8" method="post"&gt;
  &lt;p&gt;CHANGE YOUR PASSWORD:&lt;/p&gt; &lt;br /&gt;
  Your Old Password: &lt;input type="text" name="oldpassword" id="oldpassword" size="40"&gt;&lt;br /&gt;
  Your New Password: &lt;input type="text" name="newpassword" id="newpassword" size="40"&gt;&lt;br /&gt;
  Repeat Password  : &lt;input type="text" name="newpassword2" id="newpassword2" size="40"&gt;&lt;br /&gt;
  
  &lt;hr /&gt;
  &lt;p&gt;UPDATE YOUR PROFILE INFO:&lt;/p&gt; &lt;br /&gt;
  First Name: &lt;input type="text" name="fname" id="fname" size="40" value="&lt;? echo $db_first_name; ?&gt;"&gt;&lt;br /&gt;
  Last Name: &lt;input type="text" name="lname" id="lname" size="40" value="&lt;? echo $db_last_name; ?&gt;"&gt;&lt;br /&gt;
  About You: &lt;textarea name="about you" id="about you" rows="7" cols="40"&gt;&lt;/textarea&gt;
  
  &lt;hr /&gt;
  &lt;input type="submit" name="senddata" id="senddata" value="Update Information"&gt;
  &lt;/form&gt;  
  </code></pre>