Click here to Skip to main content
15,939,853 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have folders that contains images that changes every 7 days. and the filename of the folders are dates.
I want to use the filename of those folders to display them to a website.

What I have tried:

I used scandir to list the folders and this is the output:
PHP
(
    [0] => 20220728_1500
    [1] => 20220728_1800
    [2] => 20220728_2100
    [3] => 20220729_0000
    [4] => 20220729_0300
    [5] => 20220731_2100
    [6] => 20220801_0000
    [7] => 20220801_0300
    [8] => 20220804_0600
    [9] => 20220804_0900
    [10] => 20220804_1200
    [11] => 20220804_1500
    [12] => 20220804_1800
    [13] => 20220804_2100
    [14] => 20220805_0000
    [15] => 20220805_0300
)


This is a part of my JS Script which is supposedly where the folder filenames will be placed.
JavaScript
var basicdate_folders= {
        "": {
            "date": "",
        },
        "": {
            "date": "",
        },
        "": {
            "date": "",
        },
        "": {
            "date": "",
        },
        "": {
            "date": "",
        },
        "": {
            "date": "",
        },
        "": {
            "date": "",
        },
        "": {
            "date": "",
        },
    }


And I this is the HTML
HTML
<select multiple class="form-control" id="select-date" name="select-datej">
                                                                            <option disabled>Select an Initialization Date</option>
                                                                            <option selected value=""></option>
                                                                            <option value=""></option>
                                                                            <option value=""></option>
                                                                            <option value=""></option>
                                                                            <option value=""></option>
                                                                            <option value=""></option>
                                                                            <option value=""></option>
                                                                            <option value=""></option>
                                                                        </select>


The supposed to have the foldername ie. 20220722_1500

I tried to use JSON ENCODE but since I'm new to Web Languages I'm having trouble what comes after that.
Posted
Comments
Richard MacCutchan 5-Aug-22 5:49am    
You should use PHP to populate the form with the data you require. A simple loop that generates the HTML should do it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900