title: PHP PDO/MySQL: Dropdown values from database table cannot be inserted to another table
body: <p>I'm making a Helpdesk Ticket System. There seems to be a problem inserting data from a dropdown with values selected from a database table column to a database table. I'm using PHP PDO with MySQL.</p>
  
  <p>My select dropdown looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/tWdMV.png" rel="nofollow noreferrer">Dropdown picture</a></p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;label class="control-label col-md-3 col-sm-3 col-xs-12"&gt;Department &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;
      &lt;div class="col-md-9 col-sm-9 col-xs-12"&gt;
          &lt;select class="form-control" name="department" required&gt;
              &lt;option value="" disabled selected&gt;&lt;/option&gt;
              &lt;?php
                  $department_query = "SELECT * FROM department";
                  $stmt = $db-&gt;prepare($department_query);
                  $stmt-&gt;execute();
                  while ($row = $stmt-&gt;fetch(PDO::FETCH_ASSOC)){
                  echo "&lt;option value='".$row['$department']."''&gt;".$row['department']."&lt;/option&gt;";
                  }
              ?&gt;
          &lt;/select&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>It can already read and display the data <code>department_name</code> on the dropdown options.</p>
  
  <p>For inserting the values from my form, it can already insert other values EXCEPT values from the dropdown.</p>
  
  <p>My inline php code for inserting is:</p>
  
  <pre><code>&lt;?php 
            if(isset($_POST['addticket'])){
              $stmt = $db-&gt;prepare("INSERT INTO ticket (requestor_name, employee_name, department_concern, subject, description, priority) VALUES (:Requestor, :Employee, :Department, :Subject, :Description, :Priority)");
              $stmt-&gt;bindParam(':Requestor', $Requestor);
              $stmt-&gt;bindParam(':Employee', $Employee);
              $stmt-&gt;bindParam(':Department', $Department);
              $stmt-&gt;bindParam(':Subject', $Subject);
              $stmt-&gt;bindParam(':Description', $Description);
              $stmt-&gt;bindParam(':Priority', $Priority);
  
              $Requestor = $_POST['requestor'];
              $Employee = $_POST['employee'];
              $Department = $_POST['department'];
              $Subject = $_POST['subject'];
              $Description = $_POST['description'];
              $Priority = $_POST['priority'];
              $stmt-&gt;execute();
  
            }
          ?&gt;
  </code></pre>
  
  <p>There wasn't any error but it the value of the select dropdown is not inserted in my database, while other values are inserted. See picture below.</p>
  
  <p><a href="https://i.stack.imgur.com/rgou4.png" rel="nofollow noreferrer">Database Result picture</a></p>
  
  <p>I have tried changing the <code>name=""</code>, <code>$_POST['']</code> hundreds of times - still same result and I couldn't find the answer.</p>
  
  <p>All I want is to display the</p>
  
  <pre><code>"&lt;option value='".$row['$department']."''&gt;".$row['department']."&lt;/option&gt;"
  </code></pre>
  
  <p>from</p>
  
  <pre><code>&lt;select class="form-control" name="department" required&gt;
  </code></pre>
  
  <p>to </p>
  
  <pre><code>$Department = $_POST['department'];
  </code></pre>
  
  <p>so that it may be inserted into my database.</p>
  
  <p>It would be great if anyone can help me. Please. 
  Thank you in advance :)</p>