title: PHP - Unable to create file
body: <p>I am trying to create a file on my web server with an option chosen from a web form. The file never gets created and I keep getting the "Can't Open File" message.</p>
  
  <pre><code>&lt;?php
      if(isset($_POST["style"])) {
              $boots = $_POST["style"];
      }
      $file = "bootsstyle";
      if(!file_exists($file)) {
              touch($file);
              chmod($file, 0777);
      }
      $openFile = fopen($file, "w+") or die("Can't open file");
      fwrite($openFile, $boots);
      fclose($openFile);
  ?&gt;
  </code></pre>
  
  <p>I have been scouring the Internet for an hour and am not sure where I am going wrong. I have checked the permissions in the directory and they are 0777.</p>