I have that code that make me download images from other wepsite to my wepsite and after a click on submit the page is reload. I want to stop page from reload. the code I put it in some plugin in wordpress.enter image description here
the code that I put in the plugin
<form action="zip.php" method="POST">
<h2 class="inputmanga"> manga name:</h2></p>
<input type="text" name="name">
<h2 class="inputmanga"> image url:</h2></p>
<input type="text" name="img">
<h2 class="inputmanga"> image numper :</h2>
<input type="text" name="num"><br><br>
<input class="sumbitmanga" type="submit" value="Get!">
the php code that I put in separate folder
$zip = new ZipArchive();
$my_save_dir = "manga/".$_POST['name'].".zip";
$zip->open($my_save_dir, ZipArchive::CREATE);
$num = $_POST['num'];
for ($i=1; $i <= $num ; $i++) {
$url_to_image = $_POST['img'].$i.'.jpg';
$download_file = file_get_contents($url_to_image);
$zip->addFromString(basename($url_to_image), $download_file);
}
$zip->close();
echo $my_save_dir . " Download completed successfully";