Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Ole Vølund Skov Mortensen
Ole Vølund Skov Mortensen
27,841 Points

How do would I limit a "months" select-box based on another selected year and current period?

hey everyone. I'm working on a feature for my "YouTube-like" web app(i guess you call it) for my website, need some help

I built a filter of select boxes using year and months and platform...

Problem: When i selecting a new year, I want "Months" to to only show the months we're currently in that year! Not The remaining Months we're not in yet and which lacks content

Here's A snippet of the code with out the year factor

 $start = strtotime('2020-02-07');
   // example of "now" in the future vv
     $end = strtotime('2021-02-07');

    while ($start < $end) {
                    echo '<option value="'. date('n', $start) . '">' . date('F', $start) . '</option>';
                    $start = strtotime("+1 month", $start);
                    $i++;
                }