$ Day = $ _POST [‘D_DAY’];
$ months = $ _Post [‘d_MONTH’];
$ year = $ _post [‘d_year’];
$ Calculation = $ _Post [‘Calculation’];
Function DaysinMonth ($ months, $ year)
{
Return Date (“t”, mktime (0, 0, 0, $ months, 1, $ year));
}
if (Isset ($ Calculation))
{
Foreach ($ Day as $ value) {$ Day_r = $ value;}
Foreach ($ month as $ value) {$ month_r = $ value;}
Foreach ($ year as $ value) {$ year_r = $ value;}
$ month_result = $ month_r – 3;
if ($ monthsult == -2) $ monthsult = 10;
if ($ monthsult == -1) $ monthsult = 11;
if ($ monthsult == 0) $ MONTH_RESULT = 12;
$ num_Day_MONTH = CAL_DAYS_IN_MONTH (CAL_GREGORIAN, $ MONTH_RESULT, $ Year_R);
$ num_Day_MONTH = DaysinMONTH ($ MONTH_RESULT, $ Year_R);
$ Day_r = $ Day_r + 7;
if ($ Day_r > $ num_Day_MONTH)
{
$ monthsult = $ monthsult + 1;
$ Day_r = $ Day_r – $ num_Day_MONTH;
}
if ($ month_result < $ month_r) $ year_r = $ year_r + 1;
Switch ($ MONTH_RESULT)
{
CASE 1: $ MONTH_RESULT = ‘January’;
Break;
CASE 2: $ MONTH_RESULT = ‘February’;
Break;
Case 3: $ MONTH_RESULT = ‘Marta’;
Break;
Case 4: $ monthsult = ‘April’;
Break;
CASE 5: $ MONTH_RESULT = ‘May’;
Break;
CASE 6: $ MONTH_RESULT = ‘June’;
Break;
CASE 7: $ MONTH_RESULT = ‘July’;
Break;
Case 8: $ monthsult = ‘Augusta’;
Break;
Case 9: $ MONTH_RESULT = ‘September’;
Break;
CASE 10: $ MONTH_RESULT = ‘October’;
Break;
CASE 11: $ MONTH_RESULT = ‘November’;
Break;
CASE 12: $ monthsult = ‘December’;
Break;
} ?>
Result
The estimated date of birth of your baby:
‘. $ Day_r . ”. $ month_result. ”. $ year_r. ‘
‘;
}
?>