I'm trying to pass a filename to a function but don't know how to call the function from a click on a link. The top of my index.php is:

<?php
$filename = NULL;
session_start();
// start of script every time.

//  setup a path for all of your canned php scripts
$php_scripts = '/home/larry/web/test/php/'; // a folder above the web accessible tree
//  load the pdo connection module  
require $php_scripts . 'PDO_Connection_Select.php';
require $php_scripts . 'GetUserIpAddr.php';
require $php_scripts . 'mydloader.php';

//*******************************
//   Begin the script here
$ip = GetUserIpAddr();
if (!$pdo = PDOConnect("foxclone")):
{
    echo "Failed to connect to database" ;
    exit;
}
else:
{
    $stmt = $pdo->prepare("INSERT INTO download (IP_ADDRESS, FILENAME) VALUES (?, ?)");
    $stmt->execute([$ip,$filename]) ;
}
endif;
?>

<DOCTYPE html>

I want to change it from:

<a href="<?php echo "/{$deb}";?>"><img src="images/button_download.png" alt=""></a>

Which did a direct download of the file to be able to call a function in " require $php_scripts . 'mydloader.php'; " so I can make an entry in the server database and download the file but I have no idea where to start.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.