Problem populating a form

I am creating a form and I need to set the “from” date to the “to” date. I have managed to get the dates and convert them to strings $result and $lastDateOfMonth. But the two text fields remain blank. What am I doing wrong?

    $data = $this->dataStore('employees')->data();
    $dateString = $data[0]['taxyear'];   //need to append 01 to end of TY
    $lastDateOfMonth = date("Y-m-t", strtotime($dateString));
    date_modify($date,"-364 days");
    $result = $date->format('Y-m-d');
    <label for="from">from:</label><input name="from" value=<?php $result?> >
    <label for="to">to:</label><input name="to" value=<?php $lastDateOfMonth?> >

You need to echo things inside of php code to get them to be output on a web page.

echo? :slight_smile:

or perhaps:

<label for="from">from:</label><input name="from" value=<?= $result?> >
<label for="to">to:</label><input name="to" value=<?= $lastDateOfMonth?> >

That worked great. thx.

Sponsor our Newsletter | Privacy Policy | Terms of Service