phpretard Posted December 13, 2010 Share Posted December 13, 2010 Why does this work: $dateAllowedSelect = date('Y') -18; But this doesn't: $dateAllowedSelect = date('Y') +5; I nee to get the current year plus 2010 - 2015 in a select box. Thank you. Quote Link to comment Share on other sites More sharing options...
radar Posted December 13, 2010 Share Posted December 13, 2010 http://www.w3schools.com/PHP/php_date.asp that'll give ya the gist on how to do it.. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 13, 2010 Share Posted December 13, 2010 Since $dateAllowedSelect = date('Y') +5; produces the expected value of 2015, you apparently have some problem in your code that is using that value. Quote Link to comment Share on other sites More sharing options...
phpretard Posted December 13, 2010 Author Share Posted December 13, 2010 This shows the value from 2010 to 1992: <?php $dateAllowedSelect = date('Y') - 18; $myCalendar = new tc_calendar("DOB", true); $myCalendar->setPicture("images/iconCalendar.gif"); if (isset($_POST['DOB'])){ $expDOB = explode("-", $_POST['DOB']); $myCalendar->setDate($expDOB[2], $expDOB[1], $expDOB[0]); }else{ $myCalendar->setDate(date('d'), date('m'), date('Y')); } $myCalendar->setPath("./"); $myCalendar->setYearSelect($dateAllowedSelect, date('Y')); $myCalendar->dateAllow('$dateAllowedSelect-01-01', date('Y-m-d')); $myCalendar->writeScript(); ?> This only shows 2010: <?php $dateAllowedSelect = date('Y') + 3; $myCalendar = new tc_calendar("DOP", true); $myCalendar->setPicture("images/iconCalendar.gif"); if (isset($_POST['DOP'])){ $expDOP = explode("-", $_POST['DOP']); $myCalendar->setDate($expDOP[2], $expDOP[1], $expDOP[0]); }else{ $myCalendar->setDate(date('d'), date('m'), $dateAllowedSelect); } $myCalendar->setPath("./"); $myCalendar->setYearSelect($dateAllowedSelect, date('Y')); $myCalendar->dateAllow('$dateAllowedSelect-01-01', date('Y-m-d')); $myCalendar->writeScript(); ?> I can't figure the problem. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 13, 2010 Share Posted December 13, 2010 Your setYearSelect method or dateAllow method probably expects the min value to be less than the max value. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.