title: My PHP/HTML Radio Button Form in a loop is not working. Why?
body: <pre><code>&lt;?php
  
     $_SESSION['ValueSelected'] = $_POST['subject'];
  
     $num=1;
     $opt = array();
  
      for($row=1; $row&lt;=65; $row++)
           {
             if($Set_Details[0][$row - 1] == $userinID)    
          {
            echo '&lt;input type="radio" name="subject" value="$opt[$num]"&gt; ' . $Set_Details[1][$row-1] . ' - '. $Set_Details[3][$row-1] . '&lt;br&gt;';
                $num++;
         }
       }   
  ?&gt;  
  </code></pre>
  
  <p>Let me explain my code. $Set_Details is a double dimensional array and it is working without any problems. Based on the number of subjects a teacher has, that many radio buttons will be generated. Each of them has a common name but different values. Each of the subjects displayed can be selected through a radio button. Now, I want to send the selected option to another page. How should I go about doing this? Without: </p>
  
  <pre><code>$_SESSION['ValueSelected'] = $_POST['subject'];
  </code></pre>
  
  <p>The program runs normally. Only when I put this line, errors are generated. It says: </p>
  
  <pre><code>Notice: Undefined index: subject in C:\xampp\htdocs\GradingPortal\FacultyIndex.php on line 98
  </code></pre>