title: Is there a way to set a $_SESSION variable from a table which is created with a loop
body: <p>Im am working on a school project and we need to make a website using a database and what Im trying to create now is a FAQ forum for our school and all I need is a way to awnser the questions. Right now I have a table with questions generated using this code.</p>
  
  <p>`    
  
  <pre><code>  $query="SELECT vraag, vragen_id, v_naam, tv, a_naam
            FROM vragen, personen
            WHERE vak_id = 1
            AND vragen.id=personen.id
            GROUP BY vraag
            ORDER BY vragen_id DESC";
    $result=$conn-&gt;query($query);
  
    echo "&lt;table class = 'w3-table w3-striped w3-bordered w3-hoverable'&gt;";
        echo "&lt;tr&gt;";
          echo "&lt;th&gt;Vraag nummer &amp;nbsp&lt;/th&gt;";
          echo "&lt;th&gt;Gestelde vraag &amp;nbsp&lt;/th&gt;";
          echo "&lt;th&gt;Gesteld door &amp;nbsp&lt;/th&gt;";
        echo "&lt;/tr&gt;";
  
      foreach($result as $row) {
        echo "&lt;tr&gt;";
          echo "&lt;td&gt;" . $row['vragen_id'] . "&lt;/td&gt;";
          echo "&lt;td&gt;&lt;a href='antwoorden.php'&gt;" . $row['vraag'] . "&lt;/a&gt;&lt;/td&gt;";
          echo "&lt;td&gt;" . $row['v_naam'] . " " . $row['tv'] . " " .  $row['a_naam'] ."&lt;/td&gt;";
        echo "&lt;/tr&gt;";
      }
    echo "&lt;/table&gt;";
  ?&gt;`
  </code></pre>
  
  <p>And I need to know if there is a way for me to set <code>$_SESSION['vraag']</code> to the value of the <code>$row['vraag']</code> which has been clicked.</p>