I added the code for generating the due dates for present day.
Can you Please help me how can i generate the vaccination due date by selecting the date of birth.
Here is my code in
app/design/frontend/ultimo/default/template/vaccination/vaccination.phtml
<?php
$nextWeek = time() + (7 * 24 * 60 * 60);
// 7 days; 24 hours; 60 mins; 60 secs
echo 'Now: '. date('d-m-Y') ."\n";
//echo 'Next Week: '. date('Y-m-d', $nextWeek) ."\n";
// or using strtotime():
echo 'Three Week: '. date('d-m-Y', strtotime('+3 week')) ."\n";
echo 'Six Week: '. date('d-m-y', strtotime('+6 week')) ."\n";
?>
This is the date of birth in
app/design/frontend/ultimo/default/template/child/child.phtml
<form action="http://www.labwise.in/devel/vaccination-details/" method="post" id="form-validate"> <li> <label class="required"for="birthday"><em>*</em><?php echo $this->__('Date Of Birth')?></label> <div class="input-box dob"> <select name="month" class="input-text required-entry validate-select" style="width: 100px;"onchange="call()" > <option value="">Month</option> <option value="1">January</option> <option value="2">Febuary</option> <option value="3">March</option> <option value="4">April</option> <option value="5">May</option> <option value="6">June</option> <option value="7">July</option> <option value="8">August</option> <option value="9">September</option> <option value="10">October</option> <option value="11">November</option> <option value="12">December</option> </select> <select name="day" class="form-error" style="width: 100px;" id="day"> <option value="">Day</option> </select> <select name="year" class="form-error" style="width: 100px;" id="year" > <option value="">Year</option> </select> </div> </li>
***<div class="button"> <p class="required"><?php echo $this->__('* Required Fields') ?></p> <button id= "dueDateCalSubmit" type="Submit" class="button" title="<?php echo $this->__('Generate') ?>" name="send" id="send2"><span><span><?php echo $this->__('Generate') ?></span></span></button> </div>***
<script type="text/javascript">
function call()
{
var kcyear = document.getElementsByName("year")[0],
kcmonth = document.getElementsByName("month")[0],
kcday = document.getElementsByName("day")[0];
var d = new Date();
var n = d.getFullYear();
for (var i = n; i >= 2000; i--)
{
var opt = new Option();
opt.value = opt.text = i;
kcyear.add(opt);
}
kcmonth.addEventListener("change", validate_date);
function validate_date()
{
var y = +kcyear.value,
m = kcmonth.value,
d = kcday.value;
if (m === "2")
var mlength = 28 + (!(y & 3) && ((y % 100) !== 0 || !(y & 15)));
else
var mlength = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][m - 1];
kcday.length = 0;
for (var i = 1; i <= mlength; i++)
{
var opt = new Option();
opt.value = opt.text = i;
if (i == d) opt.selected = true;
kcday.add(opt);
}
}
validate_date();
}
</script>