php - how to get proper dropdown format for dates -


following code accepting date in form:

$month_array = array( "january", "february", "march", "april", "may", "june",                   "july", "august", "september", "october", "november", "december");  echo "<select name='resolved_date1' style='color:black; font-family: verdana; font-weight: bold; font-size: 12px; background-color:beige;'>"; $i = 1; while ( $i <= 31 ) { echo "<option value=".$i.">".$i."</option>"; $i++; }  echo "</select>";  echo "<select name='resolved_date2' style='color:black; font-family: verdana; font- weight: bold; font-size: 12px; background-color:beige;'>"; $i = 0; while ( $i <= 11 ) { echo "<option value=".$i." name='resolved_date2'>".$month_array[$i]."</option>";       $i++; } echo "</select>"; echo $_post['resolved_date2']; echo "<select name='resolved_date3' style='color:black; font-family: verdana; font-    weight: bold; font-size: 12px; background-color:beige;'>"; $i = 2013; while ( $i <= 2050 ) {     echo "<option value=".$i.">".$i."</option>";     $i++; } echo "</select>"; echo $_post['resolved_date3']; ?> 

the problem following statement prints month number , not month name: echo $_post['resolved_date2']; there way resolve this? how can customise number of days according months..ike if select january 31 days n dropdown , when select june 30 days in dropdown? please help...

the posted information value of option, not text. if want text, can:

echo "<option value=".$month_array[$i]." name='resolved_date2'>".$month_array[$i]."</option>"; 

to limit number of days according chosen month, you'll have on client side, using javascript or preferably 1 of frameworks jquery.


Comments