Passing filename from drop-down box to a download.php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gbuck
Forum Newbie
Posts: 6
Joined: Sun Jul 19, 2009 11:26 am

Passing filename from drop-down box to a download.php

Post by gbuck »

I have a form with a <select> box that I populate with filenames from a folder on the server using PHP. I want to go to the Force Download dialog box when the submit button is clicked for the file the user has chosen in the drop-down box.

My PHP skills (apart from the most basic uses) at this point involve a lot of hunting in books and online for code samples I can tweak. My problem is that every example I've seen of a force-download script requires the typed filename.

It seems really simple but but I'm having trouble. Is the filename already passed as variable in the _POST array? I currently using a GET method for the form.
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: Passing filename from drop-down box to a download.php

Post by jackpf »

If you use the get method then it will be in the _GET array.
gbuck
Forum Newbie
Posts: 6
Joined: Sun Jul 19, 2009 11:26 am

Re: Passing filename from drop-down box to a download.php

Post by gbuck »

Thanks for your help, but now I have anew problem. I've sorted out the filename problem, but now "file_exists" returns false.
My new post (because passing the filename is no longer the issue):

viewtopic.php?f=1&t=103370
Post Reply