Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-05-30T00:43:16.487Z
Answers.LastActivityDate: 2018-05-30T00:43:16.487Z
Answers.UserDisplayName: Brad Bell
Body: <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>
  
Tags: <form>
Title: How I can capture previous and current URL to a hidden form field
ThreadText: # 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,
  
  ```
  <input type="hidden" name="referrerUrl" value="{{ craft.app.request.getReferrer()" />
  
  <input type="hidden" name="currentUrl" value="{{ craft.app.request.getAbsoluteUrl() }}" />
  
  ```
  
  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>
  
  
  ---
  
  