How do I show previous encounter date on HTML forms?

How can I get a patient previous encounter date and use it on an HTML entry form during the current encounter? Any help!!!