Hi everybody,
First of all I'd like to specify that I'm a total newbie regarding php and coding in general. I'm turning to you because I don't know anybody that has the time to fix my problem, which is that my job requires me to work on uploading articles for a (buggy) commercial website. That isn't much of a problem, except for the fact that when I try to select an image in the drop-down menu for the product I'm uploading, the images aren't sorted in any (apparent) fashion. I have to scroll down the whole menu to find the picture I'm looking for, and there are hundreds, if not thousands of them. It's taking a lot of time, and my patience is growing thin.
I managed to find what I suspect is the main culprit, this code portion, which I think lack some sort of sorting function :
<p>Image</p>
<td>
<select name="sImage" onchange="ChangeImage('ImgProduct','image/'+this.options[selectedIndex].value)">
<?
//
echo "<option value=\"\">Aucune</option>\n";
$d = dir ("image");
while(false !== ($FileName=$d->read ()))
{
if ($FileName !="." && $FileName !="..")
{
echo "<option value=\"$FileName\">$FileName</option>\n";
}
}
$d->close ();
?>
</select>
If anybody could give me an easy solution to this problem, I'd be infinitely grateful. Thanks in advance.