title: Creating a chart using PHP & Javascript
body: <p>I'm new to PHP &amp; Javascript hence probably a lot of rookie errors - I am aiming to take 4 answers from the DB (dimension1 etc) and assign values in PHP. Then pass those PHP values to JS and insert them in the chart to display the results accordingly. The current code is not displaying anything - I'm not particulary worried about the best practise at this point and just keen to have something working. Any suggestions would be much appreciated! </p>
  
  <pre><code>&lt;?php
  
      $dbQuery = $db-&gt;prepare("select dimension1, dimension2, dimension3, dimension4 FROM indexLearningStyle WHERE studentNumber = '".$currentUser."'");
      $dbQuery-&gt; execute();
  
      while ($dbRow = $dbQuery-&gt;fetch (PDO::FETCH_ASSOC)) {
      $dimension1 = $dbRow["dimension1"];
      $dimension2 = $dbRow["dimension2"];
      $dimension3 = $dbRow["dimension3"];
      $dimension4 = $dbRow["dimension4"]; 
  
      }
  
      if  ($dimension1 = "Strongly Active"){
          $chartDimension1 = 0;
  
      }
      elseif ($dimension1 = "Moderately Active") {
          $chartDimension1 = 0.16;
  
      }
      elseif ($dimension1 = "Mildly Active") {
          $chartDimension1 = 0.32;
  
      }
      elseif ($dimension1 = "Strongly Reflective") {
          $chartDimension1 = 1.0;
  
      }
      elseif ($dimension1 = "Moderately Reflective") {
          $chartDimension1 = 0.84;
  
      }
      elseif ($dimension1 = "Mildly Reflective") {
          $chartDimension1 = 0.68;
  
      }
  
      if  ($dimension2 = "Strongly Sensing"){
          $chartDimension2 = 0;
  
      }
      elseif ($dimension2 = "Moderately Sensing") {
          $chartDimension2 = 0.16;
  
      }
      elseif ($dimension2 = "Mildly Sensing") {
          $chartDimension2 = 0.32;
  
      }
      elseif ($dimension2 = "Strongly Intuitive") {
          $chartDimension2 = 1.0;
  
      }
      elseif ($dimension2 = "Moderately Intuitive") {
          $chartDimension2 = 0.84;
  
      }
      elseif ($dimension2 = "Mildly Intuitive") {
          $chartDimension2 = 0.68;
  
      }
  
      if  ($dimension3 = "Strongly Visual"){
          $chartDimension3 = 0;
  
      }
      elseif ($dimension3 = "Moderately Visual") {
          $chartDimension3 = 0.16;
  
      }
      elseif ($dimension3 = "Mildly Visual") {
          $chartDimension3 = 0.32;
  
      }
      elseif ($dimension3 = "Strongly Verbal") {
          $chartDimension3 = 1.0;
  
      }
      elseif ($dimension3 = "Moderately Verbal") {
          $chartDimension3 = 0.84;
  
      }
      elseif ($dimension3 = "Mildly Verbal") {
          $chartDimension3 = 0.68;
  
      }
      if  ($dimension4 = "Strongly Sequential"){
          $chartDimension4 = 0;
  
      }
      elseif ($dimension4 = "Moderately Sequential") {
          $chartDimension4 = 0.16;
  
      }
      elseif ($dimension4 = "Mildly Sequential") {
          $chartDimension4 = 0.32;
  
      }
      elseif ($dimension4 = "Strongly Global") {
          $chartDimension4 = 1.0;
  
      }
      elseif ($dimension4 = "Moderately Global") {
          $chartDimension4 = 0.84;
  
      }
      elseif ($dimension4 = "Mildly Global") {
          $chartDimension4 = 0.68;
  
      }
  
   ?&gt;
   &lt;/body&gt;
  
   &lt;body class=""&gt;
  
   &lt;br&gt;&lt;br&gt;
          &lt;div id="studentILS"&gt;
          &lt;/div&gt;
   &lt;/div&gt;
   &lt;br&gt;&lt;br&gt;&lt;br&gt;
  
  
  &lt;!-- scripts --&gt;
  &lt;script src="https://code.jquery.com/jquery-3.0.0.min.js"&gt;&lt;/script&gt;
  &lt;script src="cssBipolarChart.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
  
      var chartDimension1 = &lt;?php $chartDimension1 ?&gt;;
      var chartDimension2 = &lt;?php $chartDimension2 ?&gt;;
      var chartDimension3 = &lt;?php $chartDimension3 ?&gt;;
      var chartDimension4 = &lt;?php $chartDimension4 ?&gt;;
  
      var studentResults = [
          ["Active", "Reflective", &lt;?php echo $chartDimension1; ?&gt;],
          ["Sensing", "Intuitive", &lt;?php echo $chartDimension2; ?&gt;],
          ["Visual", "Verbal", &lt;?php echo $chartDimension3; ?&gt;],
          ["Sequential", "Global", &lt;?php echo $chartDimension4; ?&gt;],
          //for example:["Sequential", "Global", 0.84],
          //["Sequential", "Global", 1.0]
      ]
  
      $(document).ready(function() {
          $("#studentILS").drawCSSBipolarChart({
              data: studentResults,
              bipolar: true
          })
      })
  &lt;/script&gt;
  </code></pre>