filemtime or getlastmod
| From: | Christian Binder | Date: | Sun, 14 Jan 2001 16:54:53 +0000 |
| Subject: | filemtime or getlastmod | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-34477@lists.php.net to get a copy of this message | ||
Hello,
I would like to create a dynamic mulitple-choise - Form, in which the
filenames, included in a subdirectory (e.g. imgstand) are listed as the
Option-vale "value" and the modification-date of the file is shown in
the HTML-page as date for selection of the user.
If a user choise one or more values form the form and press the
"Submit-Button", the script "show.phtml" should show the selected
pictures. This runs very well at this time.
The only problem is, that my following script only shows one date (IMO:
of the first value (.)), and not create the date of each file.
My Developing-System is Winnt/Apache/PHP3x but the www.server is
linux/PHP4.x of course !
The error is on both systems the same.
Who can help ?
Thank`s
Here is my phtml-Page and the included script:
----------------------------------
<html>
<head>
<meta http-equiv="content-type"
content="text/html;charset=iso-8859-1">
<title>sachstandseite</title>
</head>
<body>
<table border="0" cellpadding="0" cellspacing="2"
width="100%">
<tr>
<td>Aktuelle Meldungen</td>
<td>Bilder von früher</td>
</tr>
<tr>
<td></td>
<td>
<FORM name="pictures" method=POST action="show.phtml">
<?
$handle=opendir('imgstand'); // Name of the subdirectory, where the
files are
while ($dvzinhalt=readdir($handle))
{
$datei[]= "$dvzinhalt";
}
?>
<select name='selection[]' multiple size=<?printf(count($datei))
// for multipleselection-counter
?>>
<?
for ($i=0; $i<count($datei); $i++)
{
// "value" should be the filename for the array selection[] to
show.phtml
echo "<OPTION value=$datei[$i]>";
// get unix-timestamp form each file in subdirectory
$unixdatum=getlastmod($datei[$i]);
// change date for normal people
$datum=date("j. F Y", $unixdatum);
echo "$datum";
}
?>
</select><input type='submit' name='OK'></td>
</FORM>
</tr></table>
</body>
</html>
------------------------------------------------------