I gave it a go, and I got the error:
"Parse error: parse error, unexpected '}'"

This was on the last "}". Now I am brand new at php, but should there not be an opening and closing curly bracket? in this code there are one "{" and three "}"

So I made my code:

<?php
if ($handle = opendir('../../../mov')) {
   while (false !== ($file = readdir($handle)))

       if ($file != '.' && $file != '..')

$fileName = str_replace('.mov', '', $file);
echo '<option value="' . $file . '">' . $fileName . '</option>';
closedir($handle);
}
?>


And it does display the name in the menu... so that is a good start, but the link doesn't work when selected. So I am assuming hte code does need those brackets, and I rather need to open the opening one...

d




On 31-May-04, at 2:39 AM, [EMAIL PROTECTED] wrote:

From: "Torsten Roehr" <[EMAIL PROTECTED]>
Date: May 30, 2004 5:14:28 PM PDT
To: [EMAIL PROTECTED]
Subject: Re: drop down menu populated from a directory


"Dustin Krysak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
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

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to