Displaying a message while processing custom file

I have an import script in a custom file which takes a while to run. What I want to do:

  • After pushing the “Start” Button a “Processing…” message should appear
  • The import should be made (takes 1-2 minutes)
  • After the import the “Processing…” message should disappear and a “Successful” message should be shown

In previous versions of PHPMaker the following code (abbreviated) worked:

  • Displayed a custom form with a “submit” button (within a custom file with the common files included
  • The following code handled the import


if (isset($_POST['submit'|) {
  echo "<DIV..." which shows "Processing Message"
  flush();
  ob_flush()
  DO IMPORT
  echo "<SCRIPT>" which hides the <DIV> "Processing Message"
  ob_end_flush()
}

It does not work - the content is only shown after the complete code has executed. If I put ob_end_flush() after the first “

” the DIV is sent to the browser, but nothing else.Im quite new to output buffering - what am I doing wrong?Any help is appreciated!

It seems this would help in v2022. You may customize the code that suits your needs.