title: populating multiple select with(select=true) form from database syntax error
body: <p>I am populating a multiple select form with values from the database. what i want to do is i want some values to be selected based on the data i provide it. i am having syntax errors with my code</p>
  
  <p>here is my code:</p>
  
  <pre><code>&lt;?php
  
      $des_pos_id = $_POST['des_pos'];
      $test_tags = $_POST['test_tag_arr'];
      $test_tag=explode(',',$test_tags);
  
      $sql4 = "SELECT _id, score_type from test_category where sub_code='$des_pos_id'";
  
      $sel4 = mysqli_query($connect,$sql4);
  
      while($row4 = mysqli_fetch_assoc($sel4)){
  
          $option1 .= '&lt;option value = "'.$row4['_id'].'"'echo in_array($row4['_id'], $test_tag) ? 'selected="true"' : null;'&gt;'.$row4['score_type'].'&lt;/option&gt;';
  
      }
  
      $output = "&lt;select name='test_tags[]' id='test_tags[]' multiple&gt;";
      $output .= $option1;
      $output .= '&lt;/select&gt; ';
  
  echo $output;
  exit;
  
  ?&gt;
  </code></pre>
  
  <p>here is the error message:</p>
  
  <blockquote>
    <p>syntax error, unexpected 'echo' (T_ECHO) in /Applications/XAMPP/xamppfiles/htdocs/temp/esco-quiz/controller/script_controller.php</p>
  </blockquote>