I am almost there i thought by function expDateMonth($getm) { $msg = '<table><tr>'; $msg .= '<td>'; $expiredate = explode("-",$getm); $i=$expiredate[1]+1; $startYear = $expiredate[0]; $msg .= '<select name="expDateMonth" id="expDateMonth">'; for($i;$i<=12;$i++){ if(($i < 10) && ($i != $startMonth) ) { $i = '0'.$i; } $msg .= '<option value="'.$i.'">'.$i.'</option>'; } $msg .= '</select>'; $msg .= '</td>'; $msg .= '<td>'; $msg .= '<select name="expDateYear" id="expDateYear">'; $endYear = $startYear + 5; for($i=$startYear;$i<=$endYear;$i++){ $msg .= '<option value="'.$i.'">'.$i.'</option>'; } $msg .= '</select>'; $msg .= '</td>'; $msg .= '</tr></table>'; return $msg; } $arrivaldate = "2007-09-23"; echo expDateMonth($arrivaldate); Code (markup): the problem is every year in the future start with month 10(october). so how can i make year 2007 from the 10 month and for the future years i show all months??? regards
You would have to use a different menu. But I would go with Galen's fix. You can do validation later on. You don't seem to define $startMonth.