title: how to prevent page refresh to top page after submit
body: <p>I made a script to open all image on folder include form on it. Every time I post submit, page refreshes to the top of the page. How can I prevent it from refreshing after I hit submit?</p>
  
  <pre><code>    &lt;?php 
        $folder = ".."; //folder tempat gambar disimpan
        $handle = opendir($folder);
        echo '&lt;table cellspacing="5" cellpadding="1" width="100%" &gt;';
        echo '&lt;tr&gt;';
        $i = 1;
  
        $fileGambar = array('JPG', 'jpg');
            while(false !== ($file = readdir($handle))){
        $fileAndExt = explode('.', $file);
            if(in_array(end($fileAndExt), $fileGambar)){
        echo '&lt;td style="border:1px solid #000000;" align="center" &gt;
        &lt;div class="hvrbox"&gt;
        &lt;img src="../'.$file.'" alt="Mountains" class="hvrbox-layer_bottom" 
         width="100%" /&gt;
        &lt;div class="hvrbox-layer_top"&gt;
        &lt;div class="hvrbox-text"&gt;'.$file.'&lt;/div&gt;
        &lt;/div&gt;
        &lt;/div&gt; &lt;br&gt;&lt;/br&gt; 
  
        &lt;form method="post" name="f1"&gt;                                                             
        &lt;b&gt;&lt;u&gt;'.$file.'&lt;/u&gt;:&lt;/b&gt;
           &lt;input type="hidden" name="namafoto1" value="'.$file.'"&gt;
           &lt;input type="submit" name="upload" value="UPLOAD" /&gt;&amp;nbsp&amp;nbsp 
        &lt;/form&gt;
  
        &lt;form method="post" name="f2"&gt;
         &lt;input type="hidden" name="namafoto" value="'.$file.'"&gt;
         &lt;input type="number" min="1" max="10" value="1" name="jumlah" 
          maxlength="3" size="3" &gt;
         &lt;input type="submit" name="submitcetak" value="CETAK"&gt;&amp;nbsp&amp;nbsp
         &lt;input type="submit" name="delete" value="HAPUS CETAK" /&gt; 
        &lt;/form
  
        &lt;script type="text/javascript" src="js/jquery-1.11.3.min.js"&gt; 
        &lt;/script&gt;
        &lt;script type="text/javascript" src="js/hover-box.js"&gt;&lt;/script&gt;    
        &lt;/select&gt;
  
  
        &lt;/td&gt;';
        if(($i % 1) == 0){
        echo '&lt;/tr&gt;&lt;tr&gt;';
        }
        $i++;
        }
        }
        echo '&lt;/tr&gt;';
        echo '&lt;/table&gt;';
       ?&gt;
  </code></pre>
  
  <p>and submit script is </p>
  
  <pre><code>&lt;?php
              // Turn off all error reporting
              error_reporting(0);
              $txtx = "../upload.txt"; 
              if (isset($_POST['upload']) &amp;&amp; isset($_POST['namafoto1'])) {
              $fh = fopen($txtx, 'a++'); 
              $txtx=$_POST['namafoto1'].PHP_EOL; 
              fwrite($fh,$txtx); // Write information to the file
              fclose($fh); // Close the file
              }
              //  $txt = "../cetak.txt"; 
              //  if (isset($_POST['submitcetak']) &amp;&amp; isset($_POST['namafoto'])) {
              //  $fh = fopen($txt, 'a++'); 
              //  $txt=$_POST['namafoto'].PHP_EOL; 
              //  fwrite($fh,$txt); // Write information to the file
              //  fclose($fh); // Close the file
  
              if (isset($_POST['delete']) &amp;&amp; isset($_POST['namafoto'])) {
              rename('../print/'.$_POST['namafoto'], '../'.$_POST['namafoto']);
              delLineFromFile ();
              //echo "&lt;meta http-equiv='refresh' content='1'&gt;";
  
              }
  
              ?&gt;
  </code></pre>
  
  <p>Every time I press submit button, page refreshes and scrolls to the top of the page. Help me make it not refresh to the top of the page.</p>