title: EDITED: Fetching variables with php based on a previous function (SQL statement)
body: <p>I have the code below and I just want to call the variables from my dropdown list to a Javascript function so I can manipulate those values.</p>
  
  <pre><code>function generateColorList(){
  $selectHeaderStr = "&lt;select class='colorlist-items colorlist' name='title'    id='Colorlist' width='250px'&gt;";
  $selectHeaderEnd = "&lt;/select&gt;";
  $qryTitle = getQueryTitle();
  $connQuery = getRowByQuery($qryTitle);
  
  echo $selectHeaderStr;
  while($row = mysqli_fetch_array($connQuery)){
      echo "&lt;option  id='" . $row['title'] ."-" . $row['nid'] ."' class='colorlist-item Colorlist' data-times='" . $row['field_paint_times_value'] ."'  data-efficiency='" . $row['field_paint_efficeincy__value'] ."' value='" . $row['title'] ."'&gt;". $row['title'] . "&lt;/option&gt;";
      $p = $row[2];echo $p;echo "&lt;/br&gt;";
      $q = $row[3];echo $q ;echo "&lt;/br&gt;";
  }
    echo $selectHeaderEnd;echo '&lt;/br&gt;';
    } 
    echo generateColorList();
  ?&gt;
  &lt;script src="jquery-3.1.0.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript"&gt;
  &lt;script&gt;
  $('#Colorlist').change(function () {
  var selectedValue = (this).val();
  alert(selectedValue)};
  &lt;/script&gt;
  
  &lt;p id="times"&gt;&lt;/p&gt;
  &lt;p id="efficiency"&gt;&lt;/p&gt;
  &lt;p id="times"&gt;&lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>