I have a html/php
code as shown below which on click of a download button at Line Z
executes a php file. The drop-down list which I have from the select element at Line A is:
- Hi
- Hello
- Good Morning
- Good Evening
Let us suppose, I have selected Hi
from the dropdown list above. On hitting download button at Line Z, php file (hi.php)
belonging to Hi
dropdown gets executed.
<form method="get" action="fr_get.php">
<h1>Report</h1>
<select name="report"> <!-- Line A -->
<?php
foreach ($reports->getReports() as $report) {
$users = $report->getAll('AllowedUser'); ?>
<option value="<?= $report->path; ?>"><?= (is_array($users) && in_array('deleted',
$users) ? 'DELETED --- ' : '').$report->getFirst('Title'); ?></option>
<?php
}
?>
</select>
<div class="submit"><input type="submit" value="Download"/></div> <!-- Line Z -->
</form>
The code inside fr_get.php
is
<?php
$db = connect_mysql();
if (!is_admin()) {
die('Access Denied.');
}
$report = $_GET['report'];
include($report);
Problem Statement:
I am wondering what changes I need to make in the php code
above in the file fr_get.php
so that on click of Download button at Line Z
, report in the format of pdf or word gets downloaded
.