Jump to content

href calling php function w/ parameters


dogger

Recommended Posts

OK, in my html file, I have "${uri}" which is a directory/filename.  A link (href) is created directly from "${uri}" that opens the file when clicked.  This works great.

 

<dd><a href="${uri}">${uri}</a> (${size} bytes)<br><br></dd>

 

Now, I want to also add the ability to explor the directoy.  So I want to add another link (href) with the directory only include in "${uri}".  For example, if "${uri}" = '/this/is/the/directory/and/thefile.txt', I want an href w/ '/this/is/the/directory/and'

 

I created the file dir.php w/ the following

 

<?php

function giveme_dir_only( $a )

{

    $mydir = dirname($a );

    return $mydir;

}

?>

 

Now, how do I add this to my html/href command.  There is no reason to run the dir.php until the user actually clicks on the link, eh? 

 

<dd><a href="xxxx">"xxxx"</a> <br><br></dd>

 

Thanks in advance for the help!

Link to comment
https://forums.phpfreaks.com/topic/231515-href-calling-php-function-w-parameters/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.