In a chunk, you can make a link to the current document like this
<form method="POST" action="[~[*id*]~]">
caveat: it won’t work if you are running the PHx plugin
Other, custom, template variables that you have assigned to your template can be written into a chunk like this:
<p>The value of my variable is [*myCustomVariable*].</p>
Aside from template variables, there is a way to write other values from a snippet’s php code into chunks. Placeholders.
If you have your own snippet, you set a placeholder like this:
$modx->setPlaceholder('priceOfRaisins', '$100,000');
Then, in any chunk that comes after that snippet, you can do this:
<p>You can have some raisins, but you will have to give me [+priceOfRaisins+] first.</p>