0
I need to run a PHP function that will generate a zip file, write to the database if it was generated and the date. And right after returning the warning that was generated.
At the moment I already have all created functions that do this. Only problem and how to call the function without the refresh on the page per button, update the text field with the database generation date, if it was generated and the generation warning.
Below is the part of the short html to make it easier:
Arquivo gerado: <input type='text' readonly value=''>
Data de geração:<input type='text' readonly value=''>
Gerar arquivo:<input type="button" value="Gerar"/>
PHP:
class backup {
public function gera_arquivo() {
$zip = new ZipArchive();
if ( $zip->open( 'zips/arquivo.zip', ZipArchive::OVERWRITE ) === true) {
foreach( glob('Arquivos/DE/*.pdf') as $decreto )
$zip->addFile( $decreto, $decreto);
foreach( glob('Arquivos/PO/*.pdf') as $portaria )
$zip->addFile( $portaria, $portaria );
foreach( glob('Arquivos/LE/*.pdf') as $lei )
$zip->addFile( $lei, $lei );
foreach( glob('Arquivos/RE/*.pdf') as $resolucao )
$zip->addFile( $resolucao, $resolucao );
$zip->close();
}
I searched for hours on the internet, but I did not find anything to give me a way, maybe the solution is by ajax, but I am not very familiar with ajax.
A.... .ja...... x
– BrTkCa
Ajax
– João Paulo
Possible duplicate of How to create a website without reloading every click on a link?
– Augusto