title: Get textbox text
body: <p>When I click the button the text from the textbox should be written to a <code>.txt</code> file, which then should be downloaded. Somehow the <code>isset</code> function doesn't work, I already tried to link the php file with a <code>&lt;form</code>>, but then I can't read the textbox text.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>&lt;?PHP
  
  if(isset($_POST['submit']))
  {
      $text = $_POST['text'];
      print ($text);
  
      $filename = 'test.txt';
      $string = $text;
  
      $fp = fopen($filename, "w");
      fwrite($fp, $string);
      fclose($fp);
  
      header('Content-disposition: attachment; filename=test.txt');
      header('Content-type: application/txt');
      readfile('test.txt');
  }
  
  ?&gt;
  
  &lt;html&gt;
      &lt;head&gt;
          &lt;title&gt;Text Editor&lt;/title&gt; 
      &lt;/head&gt;
      &lt;body&gt;
          &lt;textarea name="text" rows="20" cols="100"&gt;&lt;/textarea&gt;
          &lt;p&gt;
          &lt;button type="submit" value="submit"&gt;Download Text&lt;/button&gt;
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>