So The thing in a table there are some checkboxes so based on the checkboxes user have checked it will downnload a particular coloumn of the table in the .php format. So I have tried the following code:-
public function export_php() {
$export = $this->session->userdata('export_id');
$exports = $this->query_revision_model->export($export);
$data = "";
foreach ($exports as $export) {
$data .= $export->sql_changes . "
";
}
$filename = "export.php";
$handle = fopen($filename, w);
fwrite($handle, $data);
fclose($handle);
}
So,Everything is working fine but I'm unable to provide the path for the download files,So it's saving on the application folder which I don't want. I tried force_download($filename,$data) did n't work because I am using ajax.