<p>In the context of Craft 3,</p>

<pre><code>&lt;input type="hidden" name="referrerUrl" value="{{ craft.app.request.getReferrer()" /&gt;

&lt;input type="hidden" name="currentUrl" value="{{ craft.app.request.getAbsoluteUrl() }}" /&gt;
</code></pre>

<p>You can see other methods off of the <code>web/Request</code> object you can use here: <a href="https://docs.craftcms.com/api/v3/craft-web-request.html" rel="nofollow noreferrer">https://docs.craftcms.com/api/v3/craft-web-request.html</a></p>

CC BY-SA 4.0
2018-05-30T00:43:16.487Z
2018-05-30T00:43:16.487Z
Brad Bell
<p>I need to create a hidden form field and populate the previous and current URL can someone tell me how I can do that in Craft.</p>

<form>
How I can capture previous and current URL to a hidden form field
# How I can capture previous and current URL to a hidden form field

(Asked by: username_0 on 2018-05-29)

I need to create a hidden form field and populate the previous and current URL can someone tell me how I can do that in Craft.

**Tags:** form


---

## 1 answers

### Answer by username_1 on 2018-05-30. Score: 4 | Accepted answer

In the context of Craft 3,




You can see other methods off of the web/Request object you can use here: https://docs.craftcms.com/api/v3/craft-web-request.html


---

