Hello, I have a problem in my codes. Obviously, I'm beginning to program in PHP and know nothing about its advanced concepts. So I'm asking of your help. I'd like to add 2 months to the end date the user input. I tried this code below:
public function inputEndDate() {
$value = $this->endDate;
$html = "";
$html .= '<label for="enddate">End Date:</label>' . PHP_EOL;
$html .= '<input type="text" readonly name="enddate" id="enddate" value="'.$value.'">';
$html .= '<input type="button" id="enddatebutton" onclick="getEndDate()">' . PHP_EOL;
return $html;
}
public function inputExpiryDate() {
$value = $this->endDate;
$date = date('Y/m/d', strtotime("$value +2 month"));
$html = "";
$html .= '<label for="expirydate">Expiry Date:</label>';
$html .= '<input type="text" readonly name="expirydate" id="expirydate" value="'.$date.'">';
$html .= '<input type="button" id="expirydatebutton" onclick="getExpiryDate()">' . PHP_EOL;
return $html;
}
But when I run the program, it's not displaying the correct value; however it's displaying the added two months of its start date.