title: Getting all EmployeeID's in dropdown list from mysql database?
body: <p>In my case, I am getting only the EmployeeId which i have registered <strong>latest</strong> and not all the employeeId's from the table in database.</p>
  
  <p><strong>Code :</strong></p>
  
  <pre><code>public function getEmployeeId() {
      if (!isset($_SESSION["email"]) || !isset($_SESSION["passwrd"])) {
          header("Location:index.php");
          // Cannot Access this page without Login.
      }
      if (empty($_POST)) {
          $query = mysqli_query($this-&gt;connection, "SELECT EmployeeId FROM employeeprofile") or die("Query execution failed: " . mysqli_error());
          **while ($row = $query-&gt;fetch_assoc()) {**
              $id = $row["EmployeeId"];
              $_SESSION["id"] = $id;
          }
      }
  }
  </code></pre>
  
  <p>i am using this session value in <strong></strong> tag in my html form. </p>
  
  <pre><code> &lt;select name="EmployeeId" required autofocus class='form-control'&gt;
       &lt;option value=""&gt; ----Select----&lt;/option&gt;
       &lt;?php
           if (isset($_SESSION["id"])) {
               echo "&lt;option value = " . $_SESSION["id"] . "&gt;" . $_SESSION["id"] . "&lt;/option&gt;";
           }
       ?&gt;
   &lt;/select&gt;
  </code></pre>
  
  <p>Someone suggested me to check the array , but i am confused.</p>