Array of months from today

4 posts by 2 authors in: Forums > CMS Builder
Last Post: March 19, 2013   (RSS)

By dwellingproductions - March 19, 2013 - edited: March 19, 2013

Hey Tim!

Others are much more competent than myself with PHP.  However, I would probably approach this the following way:

<?php echo date('F'); // first month ?><br />
<?php echo date('F', strtotime('+1 month')); // next month ?><br />
<?php echo date('F', strtotime('+2 month')); // second next month ?><br />
<?php echo date('F', strtotime('+3 month')); // third next month ?><br />
<?php echo date('F', strtotime('+4 month')); // fourth next month ?><br />

So, for your specific purpose, I believe the code would be:

                    <select>
                        <option value="<?php echo date('F'); ?>" selected><?php echo date('F'); ?></option>
                        <option value="<?php echo date('F', strtotime('+1 month')); ?>"><?php echo date('F', strtotime('+1 month')); ?></option>
                        <option value="<?php echo date('F', strtotime('+2 month')); ?>"><?php echo date('F', strtotime('+2 month')); ?></option>
                        <option value="<?php echo date('F', strtotime('+3 month')); ?>"><?php echo date('F', strtotime('+3 month')); ?></option>
                        <option value="<?php echo date('F', strtotime('+4 month')); ?>"><?php echo date('F', strtotime('+4 month')); ?></option>
                    </select>

Hope that helps!  :-)

- Jeremy

---------------------------

Dwelling Productions

www.dwellingproductions.com

By Toledoh - March 19, 2013

Bewdy!  Thanks for that.

Cheers,

Tim (toledoh.com.au)

By dwellingproductions - March 19, 2013 - edited: March 19, 2013

You bet!  :-)

- Jeremy

---------------------------

Dwelling Productions

www.dwellingproductions.com