How to cite a web site - USING PHP TO MANAGE FILES Building a drop-down
USING PHP TO MANAGE FILES Building a drop-down menu of files When you work with a database, you ll find you often need a list of images or other types of files in a particular folder. For instance, you may want to associate a photo with a blog entry or product detail page. Although you can type the name of the image into a text field, you need to make sure that the image is there and that you spell its name correctly. Get PHP to do the hard work for you by building a drop-down menu automatically. It s always up-to-date, and there s no danger of misspelling the name. I find this so convenient that I have turned the whole process into a function. There are two versions in the download files: one for use with PHP 5 and later, and the other for PHP 4. So, with just two lines of code, you can create a drop-down menu like that shown in Figure 7-1. Figure 7-1. PHP makes light work of creating a drop-down menu of images in a specific folder. PHP Solution 7-3: Using the buildFileList() function 1. Create a PHP page called imagelist.php in the filesystem folder. If you just want to study the code, use either imagelist_php5.php or imagelist_php4.php from the download files, depending on the version of PHP running on your server. 2. Copy buildFileList5.php (for PHP 5) or buildFileList4.php (for PHP 4) to your includes folder. 197
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.