Does anyone know how to refresh a PHP page upon pressing a "submit" button? As i need to keep the values of the variable before the refresh, will the values of the variable remain after the refresh?

If not, is there anyway i can retain the values of the variables and get the PHP file to reload itself? Thanks in advance.

    shaoen01 wrote:

    As i need to keep the values of the variable before the refresh, will the values of the variable remain after the refresh?

    What variable?

      <form action="" method="POST">
      <input type="submit" name="submit" value="refresh">
      </form>
      
        devinemke wrote:
        <form action="" method="POST">
        <input type="submit" name="submit" value="refresh">
        </form>
        

        How's that going to retain a variable?

          <input type='button' value='Refresh' onClick='javascript:location=window.location' />
          

            Everything in your form could have value=<?php echo $_POST['nameofinputtag']; ?>, which would mean that, when the form is submitted, the value of each input tag will be put back in.

            i.e.

            <form action="<?php echo $PHP_SELF; ?>" method=post enctype="multipart/form-data">
            <input type="text" name="tag1" value="<?php echo $_POST['tag1']; ?> />
            </form>

              Thanks guys. I think i managed to do it already. Cheers 🙂

                Hey guys, i realized that after i do this block of code below, i was unable to print out anything on the screen. I have added the whole php file that i am working on, process_extract_papers.php.

                Basically, process_extract_papers.php is responsible for zipping files. But you know as the number of documents grow, so will the size of zipping the files will be larger. And memory only permits 20mb of files to be zipped otherwise it will fail. For example, if there was 40mb of documents to be zipped, so i have to zip 2 times. And after the user press the start download button, i want the form to point back to itself and start zipping files for the 2nd zip file that is to be created.

                Hope you guys can help me out here, thank you.

                  [Php]
                  //This below is extracted from process_extract_papers.php.

                  if ( $HTTP_POST_VARS["download"] === "Start Download" )
                  {

                  //$numOfZipFile=$HTTP_POST_VARS["numOfZipFile"];

                      $saveasname = $HTTP_POST_VARS['zipfilename'] ;
                      $filename = $tmpDir."/".$saveasname ;
                      if ( file_exists ( $filename ) )
                      {
                         // Send binary filetype HTTP header
                          header('Content-Type: application/octet-stream');
                          // Send content-length HTTP header
                          header('Content-Length: '.filesize($filename));
                          // Send content-disposition with save file name HTTP header
                          header('Content-Disposition: attachment; filename="'.$saveasname.'"');
                          // Output file
                          readfile($filename);
                          // Done
                          exit ;
                      }
                      echo "numOfZipFile: ".$numOfZipFile;
                      //getPapers($paperInfo,$papersResult,$paperSize,$tot  al_PaperSize,$zipPartNum,$zipfilename,$zipAgain,$z  ipfile,$totalpapers);
                  } 

                  [/Php]

                    Write a Reply...