felito Posted May 31, 2011 Share Posted May 31, 2011 hi The output of this code is: 1950 1951 1952 .... script <?php for ($i = 1950; $i < 2012; $i++) { echo "<option value='$i' class='dr'>".$i.'</option>'; } ?> but i need something like: Insert a date 1950 1951 1952 .... how can i solve that? welll. i can do <option value='null' class='dr'> year</option> Quote Link to comment https://forums.phpfreaks.com/topic/238002-problem-with-loop/ Share on other sites More sharing options...
Maq Posted May 31, 2011 Share Posted May 31, 2011 Care to share the solution? Quote Link to comment https://forums.phpfreaks.com/topic/238002-problem-with-loop/#findComment-1222926 Share on other sites More sharing options...
felito Posted May 31, 2011 Author Share Posted May 31, 2011 i simply did <option value='null' class='dr'> year</option> and after this, i put the same code Quote Link to comment https://forums.phpfreaks.com/topic/238002-problem-with-loop/#findComment-1223027 Share on other sites More sharing options...
xyph Posted May 31, 2011 Share Posted May 31, 2011 Not up to the HTML spec. You want this: <option disabled="1">Year</option> Quote Link to comment https://forums.phpfreaks.com/topic/238002-problem-with-loop/#findComment-1223032 Share on other sites More sharing options...
felito Posted May 31, 2011 Author Share Posted May 31, 2011 thanks, perfect Quote Link to comment https://forums.phpfreaks.com/topic/238002-problem-with-loop/#findComment-1223086 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.