My PHP based web app has an "export" button that works. This is what it looks like. What I want to do is, once the data is exported then change that icon to a green checkbox. My PHP code on notes.php looks like:
if(isset($_POST['export_notes_to_excel'])){
$sql_for_export = explode("ORDER", $_SESSION['sql']);
$sql_for_export = $sql_for_export[0];
$filename = "Notes Exported On - " .date('Y-m-d');
$column_names = array("[Id]" => "ID", "[DateAdded]"=>"Date Added", "[Entry]"=>"Enty", "[AddedBy_Id]"=>"Officer ID");
export_sql_to_excel($sql_for_export, $filename,$column_names);
}
This code works fine and I was trying to use JS here but the problem is PHP does not render my JS if I do something like:
echo "<script>console.log('test');</script>";
after the export_sql_to_excel() function call. I wanted to do 2 things actually. First, change that download icon to a loading icon when the file is being prepared by PHP and then a checkbox icon once the file is downloaded. Any help would be appreciated. Can this even be done with PHP being the server side code? Thank you.