title: PHP fopen() and fwrite() dont work?
body: <p>I wanted a php script to execute when the user press the button. In my html file i used a jquery script</p>
  
  <pre><code>&lt;script&gt;
          $(document).ready(function(){
              $(".btn").click(function(){
  
                  var firstname = $("#firstname").val();
                  var lasname = $("#lastname").val();
                  var dataNames = { 'firstnameVal' : firstname};
                  $.post("SaveNames.php",dataNames,function()
                         {
                      alert("hi");
                  });
              });   
          });                
      &lt;/script&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>&lt;input type="text" id="firstname" name="firstname"&gt;
  &lt;input type="text" id="lastname" name="lastname"&gt;
  </code></pre>
  
  <p>in my php file i used some help from here</p>
  
  <pre><code>&lt;?php
  
  if (isset($_POST["fistname"]))
  {
          $firstname = $_POST["firstname"];
          $SavedNames = fopen("Names.txt","w");
  
          $NamesText = "Its Work!";
  
          fwrite($SavedNames,$NamesText);
          fclose($SavedNames);
  }
  ?&gt;
  </code></pre>
  
  <p>The problem is the <code>fopen()</code> doesn't work (don't create file) and I tried to create the file to check if <code>fwrite()</code> works but it's also didn't worked.</p>
  
  <p>I use localhost wamp server.</p>