title: Displaying data from database to select tag
body: <p>I want to update the data from database using select tag but the problem is I don't know how to import data to select so that when I click the Edit button, the data will be imported. So far, I imported the data to the textbox. The only problem is the select tag. </p>
  
  <p><a href="https://i.stack.imgur.com/ne5La.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ne5La.png" alt="enter image description here"></a></p>
  
  <p><strong>PHP CODE:</strong></p>
  
  <pre><code>echo "&lt;div class='col-3'&gt;";
  echo "&lt;div class='card'&gt;";
  echo "&lt;div class='row'&gt;";
  echo "&lt;div class='col-2'&gt;";
  echo "&lt;h6 class='card-title'&gt;".$row['project_name']."&lt;/h6&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='col-2'&gt;";
  echo "&lt;div class='card-setting'&gt;&lt;i class='fa fa-gear'&gt;&lt;/i&gt;&lt;/div&gt;";
  echo "&lt;div id='card-setting-dropdown' class='card-dropdown-content'&gt;";
  echo "&lt;button class='card-dropdown-menu' id='btn-edit'&gt;Edit Project&lt;/button&gt;";
  echo "&lt;button class='card-dropdown-menu'&gt;Delete Project&lt;/button&gt;";
  echo "&lt;button class='card-dropdown-menu'&gt;Add Task&lt;/button&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='row'&gt;";
  echo "&lt;div class='col-2'&gt;";
  echo "&lt;label  class='project-details'&gt;".$row['department']."&lt;/label&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='col-2'&gt;";
  echo "&lt;label class='project-details' style='float:right;'&gt;Priority: &lt;span style='color:".$color."'&gt;".$row['priority']."&lt;/span&gt;&lt;/label&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='pr-task-data'&gt;";
  echo "&lt;div class='pr-task-summary-l'&gt;";
  echo "&lt;label class='pr-task-title'&gt;Tasks&lt;/label&gt;";
  echo "&lt;p class='pr-task-details'&gt;".$count_2."&lt;/p&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='pr-task-summary-l'&gt;";
  echo "&lt;label class='pr-task-title'&gt;Completed&lt;/label&gt;";
  echo "&lt;p class='pr-task-details'&gt;".$count_3."&lt;/p&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='pr-task-summary-l'&gt;";
  echo "&lt;label class='pr-task-title'&gt;In-Progress&lt;/label&gt;";
  echo "&lt;p class='pr-task-details'&gt;".$count_4."&lt;/p&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='pr-task-summary-r'&gt;";
  echo "&lt;label class='pr-task-title'&gt;Not Completed&lt;/label&gt;";
  echo "&lt;p class='pr-task-details'&gt;".$count_5."&lt;/p&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='progress'&gt;";
  echo "&lt;div class='progress-bar' style='width:".$percent."%;'&gt;";
  echo "&lt;label class='progress-bar-percent'&gt;".$percent."%&lt;/label&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/div&gt;";
  
  echo "&lt;div id='modal_2' class='modal fade'&gt;";
  echo "&lt;div class='modal-dialog'&gt;";
  echo "&lt;div class='modal-content'&gt;";
  echo "&lt;div class='modal-header'&gt;";
  echo "&lt;h6 class='modal-title'&gt;Add Project&lt;/h6&gt;";
  echo "&lt;button type='button' class='close_2'&gt;x&lt;/button&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='modal-body'&gt;";
  echo "&lt;form autocomplete='off' method='POST'&gt;";
  echo "&lt;input type='hidden' id='".$row['project_id']."'&gt;";
  echo "&lt;div class='form-group'&gt;";
  echo "&lt;label class='form-control-label'&gt;Program&lt;/label&gt;";
  echo "&lt;input type='text' placeholder='Program' name='program' id='program_2' class='form-control'&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='form-group'&gt;";
  echo "&lt;label class='form-control-label'&gt;Project Name&lt;/label&gt;";
  echo "&lt;input type='text' placeholder='Project Name' name='pname' id='pname' class='form-control'&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='form-group'&gt;";
  echo "&lt;label class='form-control-label'&gt;Project Description&lt;/label&gt;";
  echo "&lt;input type='text' placeholder='Description' name='description' id='description' class='form-control'&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='form-group'&gt;";
  echo "&lt;label class='form-control-label'&gt;Department&lt;/label&gt;";
  echo "&lt;select class='form-control' id='department' name='department'&gt;";
  echo "&lt;option value=''&gt;Department&lt;/option&gt;";
  echo "&lt;option value='Executive Department'&gt;Executive Department&lt;/option&gt;";
  echo "&lt;option value='CCA Department'&gt;CCA Department&lt;/option&gt;";
  echo "&lt;/select&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='form-group'&gt;";
  echo "&lt;label class='form-control-label'&gt;Priority&lt;/label&gt;";
  echo "&lt;select class='form-control' id='priority' name='priority'&gt;";
  echo "&lt;option value=''&gt;Priority&lt;/option&gt;";
  echo "&lt;option value='Low'&gt;Low&lt;/option&gt;";
  echo "&lt;option value='Medium'&gt;Medium&lt;/option&gt;";
  echo "&lt;option valie='High'&gt;High&lt;/option&gt;";
  echo "&lt;option valie='High'&gt;High&lt;/option&gt;";
  echo "&lt;/select&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;div class='modal-footer'&gt;";
  echo "&lt;button type='submit' class='btn btn-update' name='update'&gt;Update&lt;/button&gt;";
  echo "&lt;button type='button' class='btn btn-secondary'&gt;Close&lt;/button&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/form&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/div&gt;";
  echo "&lt;/div&gt;";
  </code></pre>