Hello,
There are many ways how to do that by using query strings, cookies, session variables etc., but let me show you the easiest one:
a) You can create a link (a button) which would contain a document name as a query string parameter in a URL. This link can be rendered dynamically by using macros:
<a href="~/form_page.aspx?docname={%CurrentDocument.DocumentName%}">Link to a form</a>
b) Now you render or reuse this query string parameter by using query string macro instead, so to render that document name, you can just type this:
{%docname%}
Best regards,
Jan Hermann