title: How can I create an folder using PHP with the name based on the input of an HTML Form?
body: <p>I would like to create a folder using PHP with the name based on the input value of an HTML form.</p>
  
  <p>Μy html code is as follows: </p>
  
  <pre><code>&lt;input  name="foldername" id="foldername" &gt;
  </code></pre>
  
  <p>While the PHP I have is as follows:</p>
  
  <pre class="lang-php prettyprint-override"><code>if (isset($_POST['createDir'])) {
      //get value of inputfield
      $dir = $_POST['dirname'];
      //set the target path ??
      $targetfilename = PATH . '/' . $dir;
      if (!file_exists($dir)) {
          mkdir($dir); //create the directory
          chmod($targetfilename, 0777); //make it writable
      }
  }
  </code></pre>
  
  <p>My code doesn't seem to function. What am I doing wrong?</p>