I have a basic php admin system on a website.
I can upload images normally but have to enter each dir location individually.
I want to be able to type in the dir location and have the html form fields auto fill with the results from the folder.
I have done basic research into using readdir and glob functions.
I managed to get results out with readdir but they came out random. Can anyone point me in the right direction?
<body>
<p>
<?php
include 'mysqlconfig.php';
include 'opensqldb.php';
$files = scandir('photos');
foreach($files as $file) {
echo $file ;
}
?>
</p>
<form id="form1" name="form1" method="post" action="">
<label for="textfield"></label>
<p>
<input name="textfield" type="text" id="textfield" value="<? echo $file[0] ?>" />
</p>
<p>
<input name="textfield2" type="text" id="textfield2" value="<? echo $file[1] ?>" />
</p>
<p>
<input name="textfield3" type="text" id="textfield3" value="<? echo $file[2] ?>" />
</p>
</form>
</body>
This is what I have so far, the echo in the form fields pushes out the first three letters of the filename.