title: Cannot clear a form after submission
body: <p>I have a form with drop down lists and I want to clear after I submit it and it shows the table. I searched for clearing a form and I found to use javascript. I read this article <a href="https://stackoverflow.com/questions/6028576/how-to-clear-a-form">how to clear a form</a>. I wrote the following javascript code, but it doesn't work.</p>
  
  <pre><code>   myjavascript.js
       &lt;script type="text/javascript"&gt;
       &lt;!--clear function--&gt;
       function resetForm(form){
       // clearing selects
            var selects = form.getElementsByTagName('select');
             for (var i = 0; i&lt;selects.length; i++)
           selects[i].selectedIndex = 0;
  
       return false;
       }
      &lt;/script&gt;
  </code></pre>
  
  <p>This is my form:</p>
  
  <pre><code>    principal.php
       &lt;?php
  
       if ($_SERVER['REQUEST_METHOD'] == 'POST'){
       switch ($_POST['program']){
  
       case 'BSc Computer Science':
            include 'csreadprog.php';
            break;
       case 'BSc Psychology':
            include 'psyreadprog.php';
            break;
       case 'BA Business Administration':
             include 'baedreadprog.php';
             break;
      }
  
       switch ($_POST['services']){
  
        case 'Library':
              include 'libraryread.php';
              break;
  
        case 'IT Services and Facilities':
            include'itserviceread.php';
            break;
  
        case 'Front Desk':
            include'frontdeskread.php';
            break;
  
        case 'Course Administrator':
            include'courseadminread.php';
            break;
  
        case 'International Student Office':
             include'stofficeread.php';
             break;
  
        case 'Clubs and Societies':
             include'clubsread.php';
             break;
       }
  
        switch($_POST['program'] &amp;&amp; $_POST['criteria']){
  
        case 'BSc Computer Science' &amp;&amp; 'I have found the unit interesting':
                include 'readcsprogcrit.php';
                break;
  
        case 'BSc Psychology' &amp;&amp; 'I have gained knowledge':
                include 'readpsyprogcrit.php';
                break;
  
        case 'BA Business Administration' &amp;&amp; 'I have acquired skills':
               include 'readbaedprogcrit.php';
               break;
  
        }
        switch($_POST['year']){
  
        case 'BSc Computer Science' &amp;&amp; '2005':
  
            include 'readcsprogyear.php';
            break;
  
         case 'BSc Psychology' &amp;&amp; '2005':
            include 'readpsyprogyear.php';
            break;
  
         case 'BA Business Administration' &amp;&amp; '2005':
             include 'readbaedprogyear.php';
             break;
  
         }
  
      exit;
    }   
  ?&gt;
  
    &lt;html&gt;
    &lt;head&gt;
       &lt;link rel="stylesheet" type="text/css" href="style.css"&gt;
      &lt;script type="text/javascript" src="myjavascript.js"&gt;&lt;/script&gt;
  
     &lt;/head&gt;
    &lt;body&gt;
  
    &lt;div class="nav"&gt;
         &lt;ul&gt;
  
          &lt;li&gt;&lt;a href="principal.php"&gt;Principal&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="acad_director.php"&gt;Academic Director&lt;/a&gt;&lt;/li&gt;
          &lt;li&gt;&lt;a href="lecturer.php"&gt;Lecturer&lt;/a&gt;&lt;/li&gt;
  
         &lt;/ul&gt;
     &lt;/div&gt;
  
  &lt;form method="POST" action="principal.php" name="myform"&gt;
  &lt;b&gt;Programs:&lt;b/&gt;
  &lt;select name="program"&gt; 
  &lt;option value="Choose"&gt;Please select..&lt;/option&gt;
  &lt;option value="Computer Science"&gt; BSc Computer Science&lt;/option&gt; 
  &lt;option value="BAED"&gt;BA Business Administration&lt;/option&gt;
  &lt;option value="Psychology"&gt;BSc Psychology&lt;/option&gt;&lt;/select&gt;&lt;br/&gt;&lt;br/&gt;
  
  &lt;b&gt;Departments:&lt;b/&gt;
  &lt;select name="department"&gt; 
  &lt;option value="Choose"&gt;Please select..&lt;/option&gt;
  &lt;option value="Computer Science"&gt;Computer Science&lt;/option&gt; 
  &lt;option value="BAED"&gt;BAED&lt;/option&gt;
  &lt;option value="Psychology"&gt;Psychology&lt;/option&gt;&lt;/select&gt;&lt;br/&gt;&lt;br/&gt;
  
  &lt;b&gt;Year:&lt;b/&gt;
  &lt;select name="year"&gt; 
  &lt;option value="Choose"&gt;Please select..&lt;/option&gt;
  &lt;option value="2005"&gt;2005&lt;/option&gt; 
  &lt;option value="2006"&gt;2006&lt;/option&gt;
  &lt;option value="2007"&gt;2007&lt;/option&gt;
  &lt;option value="2008"&gt;2008&lt;/option&gt;
  &lt;option value="2009"&gt;2009&lt;/option&gt;
  &lt;option value="2010"&gt;2010&lt;/option&gt;&lt;/select&gt;&lt;br/&gt;&lt;br/&gt;
  
  &lt;b&gt;Criteria:&lt;b/&gt;
  &lt;select name="criteria"&gt; 
  &lt;option value="Choose"&gt;Please select..&lt;/option&gt;
  &lt;option value="I have found the unit interesting"&gt;I have found the unit interesting&lt;/option&gt; 
  &lt;option value="I have gained knowledge"&gt;I have gained knowledge&lt;/option&gt;
  &lt;option value="I have acquired skills"&gt;I have acquired skills&lt;/option&gt;
  &lt;option value="Useful other resources"&gt;Useful other resources&lt;/option&gt;&lt;/select&gt;&lt;br/&gt;&lt;br/&gt;
  
  &lt;b&gt;Services:&lt;b/&gt;
  &lt;select name="services"&gt; 
  &lt;option value="Choose"&gt;Please select..&lt;/option&gt;
  &lt;option value="Library"&gt;Library&lt;/option&gt; 
  &lt;option value="Course Administrator"&gt;Course Administrator&lt;/option&gt;
  &lt;option value="International Student Office"&gt;International Student Office&lt;/option&gt;
  &lt;option value="IT Services and Facilities"&gt;IT Services and Facilities&lt;/option&gt;
  &lt;option value="Front Desk"&gt;Front Desk&lt;/option&gt;
  &lt;option value="Clubs and Societies"&gt;Clubs and Societies&lt;/option&gt;&lt;/select&gt;&lt;br/&gt;&lt;br/&gt;
  
  &lt;br/&gt;
  &lt;input type="submit" name="submit" value="Submit"&gt;
  &lt;input type="reset" name="reset" value="Clear"&gt;
  
  &lt;/form&gt;
  </code></pre>
  
  <p>
  </p>