title: i wrote my view code in controller page to fetch data from database, but my script is not working in that code
body: <p>I wrote my view code in the controller page to fetch data from the database, but my script is not working in that code.
  I want to when the user click on the radio button then the profile section is hidden and the course section will be shown.</p>
  <p><img src="https://i.stack.imgur.com/sVnrD.png" alt="enter image description here" /></p>
  <p>Controller Code :</p>
  <pre><code>if(array_sum($arrCount)==0)
  {
    echo '&lt;div class=&quot;chat-message-div&quot;&gt;
          &lt;div class=&quot;chat-message&quot; style=&quot;color:red;&quot;&gt;
          Sorry I cant recognize you.Please provide a bit more details
          &lt;/div&gt;
          &lt;/div&gt;'; 
    exit; 
  }
  else
  {
      $max = $arrCount[0];
      $indicate = 0;
      for($i=1;$i&lt;count($arrCount);$i++)
      {
          if($arrCount[$i]&gt;$max)
          {
              $max = $arrCount[$i];
              $indicate = $i;
          }
      }
  
      echo '&lt;div class=&quot;chat-message-div&quot;&gt;
              &lt;div class=&quot;chat-message&quot;&gt;
                  '.$arr[$indicate]['answer'].'
                  &lt;div class=&quot;radio&quot;&gt;
                      &lt;label&gt;&lt;input type=&quot;radio&quot; id=&quot;msg6&quot; name=&quot;q6&quot; value=&quot;'.$arr[$indicate]['option1'].'&quot;&gt;'.$arr[$indicate]['option1'].'&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;radio&quot;&gt;
                      &lt;label&gt;&lt;input type=&quot;radio&quot; id=&quot;msg6&quot; name=&quot;q6&quot; value=&quot;'.$arr[$indicate]['option2'].'&quot;&gt;'.$arr[$indicate]['option2'].'&lt;/label&gt;
                  &lt;/div&gt;
  
                  &lt;div class=&quot;radio&quot;&gt;
                      &lt;label&gt;&lt;input type=&quot;radio&quot; id=&quot;msg6&quot; name=&quot;q6&quot; value=&quot;'.$arr[$indicate]['option3'].'&quot;&gt;'.$arr[$indicate]['option3'].'&lt;/label&gt;
                  &lt;/div&gt;
                  &lt;div class=&quot;radio&quot;&gt;
                      &lt;label&gt;&lt;input type=&quot;radio&quot; id=&quot;msg6&quot; name=&quot;q6&quot; value=&quot;'.$arr[$indicate]['option4'].'&quot;&gt;'.$arr[$indicate]['option4'].'&lt;/label&gt;
                  &lt;/div&gt;
                  
              &lt;/div&gt;
          &lt;/div&gt;
  
          ';
  
      exit;
  }
  </code></pre>
  <p>javascript code.</p>
  <pre><code>&lt;script type=&quot;text/javascript&quot;&gt;
      $(document).ready(function() { 
          $('input[name=&quot;q6&quot;]').on('click', function() { 
              var test = $(this).val(); 
              $('.profile').hide(); 
              $(&quot;#user-profile&quot;).hide(); 
              $('.courses').show(); 
          }); 
      }); 
  &lt;/script&gt;
  </code></pre>