I do not have much programming in php and I hope I can help those that I want to do is that when entering in the form the date 1 and the date2 I calculate if between those two dates if they have passed 5 or more years and I add 3 more days taking As reference date 2, I do not know if I understand.
To see a theoretical example date = 10/01/2012 date2 = 23/07/2017
Between these two dates have passed 5 years, 6 months, and 13 days elapsed
Knowing this my serious conditional
If they are equal or more than 5 years but less than 10 years will be added 3 days
If they are equal or more than 10 years but less than 15 years will be added 6 days
If they are equal or more than 15 years but less than 20 years will be added 9 days
If they are equal to or more than 20 years will be added 12 days
Then having the conditionals
For this example would be case as it is greater than 5 years the result that I should show taking in days, having as date of departure the date2 = 23/07/2017 and to this date it is added 30 days that would be a constant and depending on the Years as the example happens 5 years would be: date2 = 23/07/2017 + 30 days = 08/30/2017 + 3 days
= End date to show = result = 02/09/2017.
But I still think how to do it if you can guide me I would appreciate a world, and everything should show without pressing buttons, if I press a button would be like to store in the database only the results otenidos as date1 date2 and result
<? Php
// $ date1 = $ _ POST ["date1"]; // this will be the first date or date of entry
// $ date2 = $ _ POST ["date2"]; // this will be the date with which you will calculate
// $ difference = $ date2 - $ date1;
// if ($ difference <= 5)
{
// echo "number of days that correspond to it [". $ Date2 + 30 + 3. "].";
//} else {
// ($ difference <= 5)
{
// echo "number of days corresponding to it [" $ date2 + 30 "].";
}
?>