title: Launch PHP function when button is pressed
body: <p>I have a php function that writes some text to a local file...</p>
  
  <pre><code>&lt;?php
   function createtextfile() 
   {
   $file = fopen("test.txt","w");
  echo fwrite($file,"Hello World. Testing!");
  fclose($file);
  }
  ?&gt;
  </code></pre>
  
  <p>I am trying to launch this when a button is clicked but am not sure how best to go about it.  Would I need to use javascript or is there a way I can do it purely with PHP?</p>