Re: drop down menu populated from a directory

From: Date: Mon, 31 May 2004 00:14:28 +0000
Subject: Re: drop down menu populated from a directory
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-187256@lists.php.net to get a copy of this message
"Dustin Krysak" <mailinglists@digitalcollision.com> wrote in message news:B965865C-B293-11D8-8990-000A95902366@digitalcollision.com... > Hi there.... > > What I am hoping to do is have a drop down menu that would be populated > from the contents of a directory via php. Now The link names would be > generated by the file name minus the file extension. Has anyone seen a > tutorial on accomplishing something like this? All of the links would > be to quicktime movies, but I am hoping to have them embedded in HTML > (or PHP)..... So the movie is displayed in a browser.... > > thanks in advance! This should do the trick: // opening select tag goes here... if ($handle = opendir('/path/to/files')) { while (false !== ($file = readdir($handle))) if ($file != '.' && $file != '..') $fileName = str_replace('.mov', '', $file); echo '<option value="' . $file . '">' . $fileName . '</option>'; } } closedir($handle); } // closing select tag goes here Haven't tested it. Hope it works and helps ;) Regards, Torsten Roehr

« previous php.general (#187256) next »