title: How to call a javascript function as well as save the form data into a text file in a html page?
body: <p>here is my html code.....  </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;title&gt;Plot&lt;/title&gt;
  &lt;head&gt;
      &lt;script type="text/javascript" src="d3.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      function refilter()
      {
          var ch = document.getElementById('Choice').value;
          //do something
      }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form action="save.php" name="myform" method="POST"&gt;
      Select any station:&lt;select id="Choice" name="choice"&gt;
          &lt;option value="None"&gt;Select&lt;/option&gt;
          &lt;option value="option1"&gt;DELHI&lt;/option&gt;
          &lt;option value="option2"&gt;MUMBAI&lt;/option&gt;
          &lt;/select&gt;
       &lt;input type="button" onclick="refilter()" value="Submit!"&gt;
  &lt;/form&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I wish to do two things:<br>
  1.save the "choice" entered by user, since I have to do further task using it and<br>
  2.call the "refilter" function.  </p>
  
  <p>As of now, I tried using php and store the "choice" in a text file but for that i need to change "input type=submit" and if I do so,  </p>
  
  <p>1.The function is not called.<br>
  2.the save.php file opens up, which i dont want. I wish to stay on the html page only.</p>
  
  <p>I am a beginner to javascript and html and knew a little php, so tried my hand at that.</p>
  
  <p>Is there anyway I can do both the tasks together?</p>