dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Get the link text

  1. #1
    Join Date
    Dec 2008
    Posts
    11

    Get the link text

    Hi, I have loaded the whole file directory of a folder. and show the file name as a link. I would like do a delete function. When the user click the file name, it will trigger a php function to do the file delete.

    However, I dont know how to get the file name that the user have clicked. Could you give me some advices on this?

    Thank you.

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,943

    Re: Get the link text

    You are already creating a link to the file, but yet you can't get the filename? You're not making any sense.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jan 2003
    Location
    7,107 Islands
    Posts
    2,487

    Re: Get the link text

    ^lol

    Code:
    echo "<a href=\"delete.php?file=$filename&folder=$folder\">$filename</a>";
    Busy

  4. #4
    Join Date
    Dec 2008
    Posts
    11

    Re: Get the link text

    Sorry, maybe I make my question clearer first.

    I will display all the files in the folder /downloads
    #echo the files
    foreach ($files as $file) {
    if ($file != "." && $file!= ".."){
    echo "<a href=fileManager.php?filename=$file>$file</a><br />";
    }
    }

    and there is a textbox (for displaying the selected file) and a delete button(after clicking it, the file displayed in the textbox will be deleted)

    My problem is how to put the filename to the textbox when the user click on the link.
    It works for filename with no space. However, it doesnt work for the one with space.

    Any advice for solving the problem?

    Thank you.

  5. #5
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,943

    Re: Get the link text

    There will be no output difference between a textbox and a line. Just use the onclick event to redirect.

    As for the spaces, replace them with &#37;20.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)