title: How to retrieve textbox data in php
body: <p>I want to retrieve the data from a textbox which I created. Please take look at my code and help me.</p>
  
  <pre><code>&lt;?php
  if(isset($_GET['ok']))
  {
  $a=1;
  $n=$_GET['n'];
  for($i=0;$i&lt;$n;$i++){
      echo '&lt;form action="exa.php" method="get"&gt;';
  echo '&lt;input type="text" name="kal'.$a.'"/&gt; &lt;br/&gt;'; 
  echo '&lt;/form&gt;';
  $a++;} $a=1;
  for($i=0;$i&lt;$n;$i++)
  {
      $txtnm="kal".$a;
      $kal=$_GET['$txtnm'];
      echo $kal;  
      $a++;
  }
  }
  ?&gt;
  
  &lt;html&gt;
  &lt;body&gt;
  &lt;form action="exa.php" method="get"&gt;
  &lt;input type="text" name="n"/&gt;&lt;br/&gt;
  &lt;input type="submit" value="OK" name="ok"/&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here I am getting an error saying <code>'undefined index $txtnm'</code></p>