Well, I have a page with links to reports. Whenever somebody clicks on one report, they can download the excel file. However, sometimes there are no fields to make a report; in that case, I want to display an alert message and after they click on "accept", they get redirected to the main panel. When they click on the report, they go to a controller that uses a
if ($result_array != FALSE)
echo "<script>alert('There are no fields to generate a report');</script>";
echo "<script> alert('There are no fields to generate a report'); window.location.href='admin/ahm/panel'; </script>";
and get rid of
redirect line below.
You were mixing up two different worlds.