title: Endless If-Else statements
body: <p>I'm trying to update the records whereby I found out that I will be doing alot of If-Else Statements for checking. For example, now i have 4 upload buttons inside my form. If the document has been attached, there would not be any upload button. But it is updated to the database, it will show errors because the user did not attached any document. Maybe I'll explain out in my code and will give a clearer picture.</p>
  
  <pre><code>Code for my form:
  &lt;form id = "update" action ="update.php"&gt;
  //Code is repeated for all upload and download buttons just that one is for test, assign, and papers
  &lt;?php
  if ($Attached== "No")
  {
              echo "&lt;select name=\"Test\" id=\"Test\"&gt;";
              echo "&lt;option value=\"No\" selected=\"selected\"&gt;No&lt;/option&gt;";
              echo "&lt;input name=\"Attached[test]\" id=\"Test\" type=\"file\"/&gt;";
              echo "&lt;/select&gt;";
  
  }
  else
  { 
           Button to download the document
              $fullpath = "./documents/."$Test"; 
          echo "&lt;input type=\"hidden\" name=\"fullpath\" value=\"$fullpath \"/&gt;";
          echo "&lt;input type=\"submit\" name=\"download\" value=\"download\"/&gt;";
  }
  ?&gt;
  &lt;/form&gt;
  
  Update.php code:
  //So if i wish to update into my database sqlite3, i'll need to check as follows:
  $test = $_POST['Attached[test]'];
  $ID = 1;
  $DB = = new PDO('sqlite:database/Test.DB');
  If ($test != "")
  {
      $update = $DB-&gt;prepare('update test set test =?, assign =?, papers =?);
      $execute = $update-&gt; execute (array($test, $assign, $paper));
  
  }
  else if ($test == $test)
  {
      $update = $DB-&gt;prepare('update test set assign =?, papers =? where ID=?);
      $execute = $update-&gt; execute (array($assign, $paper));
  }
  else
  {
      moveuploaded_files();
  }
  </code></pre>
  
  <p>So my question is how can i shorten my ife-else statement to check if the individual value actually exists in database already and don't update that particular column(s).
  Kindly advise thanks</p>