title: Can't read $_POST[] value from a PHP form
body: <pre><code>&lt;?php
  echo "&lt;form action='bossconfirm2.php' method='post' name='bossex' onsubmit='blankCheck()' &gt;";
  
  echo "&lt;td&gt;&lt;select id='disapprove".$i."' name = 'sel".$i."'&gt;
                &lt;option value = '".$row['LeaveID']."'&gt;Approve&lt;/option&gt;
                &lt;option value = '2'&gt;Disapprove&lt;/option&gt;
            &lt;/select&gt;".$i."&lt;/td&gt;";
  </code></pre>
  
  <p>My Code goes something like the one above. I'm trying to pass the value of sel+$i (which would be sel1 when concatenated) to the php file bossconfirm2.php. Here's my code for bossconfirm2.php:</p>
  
  <pre><code>$se11 = $_POST['sel1'];
  $se12 = $_POST['sel2'];
  $se13 = $_POST['sel3'];
  $test = $_POST['test'];
  
  echo "HI&lt;br&gt;";
  echo "&lt;br&gt; ".$test."&lt;br&gt;";
  
  echo "Sel 1 &lt;br&gt;".$sel1."Sel 2&lt;br&gt;".$sel2."Sel 3 ".$sel3;
  </code></pre>
  
  <p>Whenever the I display the values for <code>$sel1</code>, nothing appears. I placed an echo "HI<br>"; to see if there's something wrong with the PHP syntax but I've discovered that the <code>$_POST[]</code> just can't access the form. I tried adding an html syntax at the end of the file to see if I could pass a value to <code>$test</code> with this code</p>
  
  <pre><code>&lt;td&gt;&lt;input type='text' name='test'&gt;&lt;/td&gt;
  </code></pre>
  
  <p>and it worked. It seems that the form I created using pure PHP (echo ..etc) can't pass values. Somebody please enlighten me as to how I could make it work?</p>
  
  <p>Edit:
  Here's my complete code</p>
  
  <pre><code>&lt;?php
  echo "&lt;form action='bossconfirm2.php' method='post' name='bossex' onsubmit='blankCheck()' &gt;";
  
  include 'config.php';
  include 'opendb.php';
  
  $testing = $_REQUEST['parent_id'];
  
  $appSql = "SELECT f.LeaveId, CONCAT(p.LastName, ', ', SUBSTRING(p.Firstname,1,1), '.') 'Name',
  CONCAT(DATE_FORMAT(f.DateFrom, '%b %e, %Y'),
  ' (',x.Scope,')')'From' ,
  CONCAT(DATE_FORMAT(f.DateTo, '%b %e, %Y'), ' (', y.Scope,')')'To',
  t.Abbreviation, r.Reason
  FROM hris.tblpersonaldata p, timesys.tblfiledleaves f, hris.tblgroupings h,
  hris.tblsector_deptoroffice d, timesys.tblleaveapproval a, timesys.tblleavetypes t,
  timesys.tbllkupreason r,
  timesys.tbllkupscope x, timesys.tbllkupscope y
  WHERE
  f.ScopeFromID = x.ScopeID AND f.ScopeToID = y.ScopeID
  AND p.ID = f.EmpID
  AND p.ID = h.ID AND h.SectorDeptOrOfficeID = d.SectorDeptOrOfficeID
  AND f.EmpID = a.empID
  AND a.leaveStatusID = '2'
  AND f.LeaveTypeID = t.LeaveTypeID
  AND f.ReasonID = r.ReasonID
  AND f.DateReceived &gt; '2011-07-31'
  GROUP BY f.LeaveID
  ORDER BY f.LeaveID ASC
  LIMIT 3";
  
  $appSqlQ = mysql_query($appSql) or die(mysql_error());
  $lol =mysql_query("SELECT approvalID FROM timesys.tblleaveapproval WHERE leaveStatusID = '2';");        
  $rwww = mysql_fetch_array($lol);
  
  if(is_null($rwww[0]))
      echo "No Pending Leave Approval";
  
  else{
      echo "&lt;table &gt;";
      echo "&lt;tr &gt;";
      echo "&lt;td bgcolor = '888888'&gt;Name&lt;/td&gt;";
      echo "&lt;td bgcolor = '888888'&gt;From&lt;/td&gt;";
      echo "&lt;td bgcolor = '888888'&gt;To&lt;/td&gt;";
      echo "&lt;td bgcolor = '888888'&gt;Leave Type&lt;/td&gt;";
      echo "&lt;td bgcolor = '888888'&gt;Reason&lt;/td&gt;";
      echo "&lt;td bgcolor = '888888'&gt;Approval&lt;/td&gt;";
      echo "&lt;/tr&gt;";
      $i = 1;
      while($row = mysql_fetch_array($appSqlQ))
      {
                  //$i = 1;
  
                  echo "&lt;tr&gt;";
                  echo "&lt;td bgcolor = 'FFF111'&gt;" . $row['Name'] . "&lt;/a&gt;&lt;/td&gt;";
                  echo "&lt;td&gt;" . $row['From'] . "&lt;/td&gt;";
                  echo "&lt;td bgcolor = 'FFF111'&gt;" . $row['To'] . "&lt;/td&gt;";
                  echo "&lt;td&gt;" . $row['Abbreviation'] . "&lt;/td&gt;";                
                  echo "&lt;td bgcolor = 'FFF111'&gt;" . $row['Reason'] . "&lt;/td&gt;";
  
                  echo "&lt;td&gt;&lt;select id='disapprove" . $i . "' name = 'sel" . $i . "'&gt;
                              &lt;option value = '" . $row['LeaveID'] . "'&gt;Approve&lt;/option&gt;
                              &lt;option value = '2'&gt;Disapprove&lt;/option&gt;
                            &lt;/select&gt;
                            " . $i . "
                      &lt;/td&gt;";
  
                      echo "&lt;td&gt;    
                      &lt;div id='disss" . $i . "'&gt;
                      &lt;input size =18 class='textBox' type='textbox' value='Reason for disapp...' name = 'box" . $i . "' id='a" . $i . "'&gt;
                      &lt;/div&gt;
                      &lt;/td&gt;";
  
                  $i++;    
  
                  echo "&lt;br&gt;";
                  echo "&lt;/tr&gt;";
  
      }        
      echo "&lt;tr&gt;";
      //echo "&lt;td&gt;&lt;button onclick='test111();'&gt;CLieck&lt;/button&gt;&lt;/td&gt;";
  echo "&lt;td&gt;&lt;input type='Submit' value='Submit'/&gt;&lt;/td&gt;";
  //echo "&lt;td&gt;&lt;input type='Reset' value='Reset' /&gt;&lt;/td&gt;";
  echo "&lt;/tr&gt;";
  }                 
  echo "&lt;/form&gt;";
  
  
  ?&gt;
  &lt;td&gt;&lt;input type='text' name='test'&gt;&lt;/td&gt;
  </code></pre>
  
  <p>And here's my code for bossconfirm.php</p>
  
  <pre><code>&lt;?php
  include 'config.php';
  include 'opendb.php';
  session_start();
  $sessionID = $_SESSION['id'];
  $x = 0;
  $checkValue = $_POST['value'];
  
  $sel1 = $_POST['sel1'];
  $sel2 = $_POST['sel2']; 
  $sel3 = $_POST['sel3']; 
  $test = $_POST['test'];
  
  echo "HI&lt;br&gt;";
  echo "&lt;br&gt; " . $test . "&lt;br&gt;";
  
  echo "Sel 1 &lt;br&gt;" . $sel1 . "Sel 2&lt;br&gt;" . $sel2 . "Sel 3 " . $sel3;
  
  $today = date('Y-m-d');
  ?&gt;
  </code></pre>