phpretard Posted July 3, 2010 Share Posted July 3, 2010 This work for adding 18 years but not subtracting... function select_yr(){ // WORKS $stopy = (int)date('Y') + 18; for($y = date('Y'); $y < $stopy; $y++){ echo '<option value="'.$y.'">'.$y.'</option>'; } } function select_yr(){ // DOES NOT WORK $stopy = (int)date('Y') - 18; for($y = date('Y'); $y < $stopy; $y++){ echo '<option value="'.$y.'">'.$y.'</option>'; } } Any help? Thank you Quote Link to comment Share on other sites More sharing options...
phpretard Posted July 3, 2010 Author Share Posted July 3, 2010 function select_yr(){//works $stopy=date('Y')+1; for($y = date('Y')-18; $y < $stopy; $y++){ echo '<option value="'.$y.'">'.$y.'</option>'; } } 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.