<p>It depends to some extent whether the form is a login/registration form (to a user account) or just an information form, that you are saving in the database.</p>

<p>If the resources page is restricted and requires login, then you should place <code>{% requireLogin %}</code> at the top of your resources template. If anyone requests this page they will automatically be redirected to the login page, and after a successful login, will be routed back to the original request, which was the resources page. The login page can have a link to 'create account' with the additional fields you need, if they don't already have one.</p>

<p>If it is just an information form and not for login then you can simply create a form with the required fields. Submit the form using <code>action/saveEntry</code> along with a hidden field called <code>redirect</code> as explained <a href="http://buildwithcraft.com/docs/templating/entry-form" rel="nofollow">here</a>.</p>

<pre><code>&lt;form method="post" action="" accept-charset="UTF-8"&gt;
    &lt;input type="hidden" name="action" value="entries/saveEntry"&gt;
    &lt;input type="hidden" name="redirect" value="path/to/resources"&gt;
    ...
&lt;/form&gt;
</code></pre>

<p>This is not secure however. If you need to make certain that they just don't go straight to the resources page without filling out the form, then you can test for the existence of an <code>entry.id</code> on the resources page (which is what is returned from a successful <code>entries/saveEntry</code>), and redirect them back to the form again if not defined. However, this would make the resources page viewable only once (unless you set a cookie or store session data, etc). And they would have to fill out the form every time they wanted to view it, which doesn't sound like what you want. In which case go with the login route above.</p>

<p>There are example templates for <a href="http://buildwithcraft.com/docs/templating/login-form" rel="nofollow">login</a>, <a href="http://buildwithcraft.com/docs/templating/user-registration-form" rel="nofollow">user registration</a>, and others (more links at bottom left of those pages). </p>

CC BY-SA 3.0
2014-10-04T02:55:53.977Z
2014-10-04T02:55:53.977Z
Douglas McDonald
<p>I am creating a resources page, on which a resource can be downloaded after filling or submitting a form. This form is having user info fields like first name, last name, email etc. Could anyone please suggest me how can I implement it in Craft.﻿</p>

CC BY-SA 3.0
2014-10-04T02:34:54.940Z
Hi Bhashakar, welcome to Craft Stack Exchange! This question is very broad, can you please edit to make it more specific? It would help to know where you are starting from... what have you already tried?
Lindsey D
<form>
Download resource form page
# Download resource form page

(Asked by: username_0 on 2014-10-03)

I am creating a resources page, on which a resource can be downloaded after filling or submitting a form. This form is having user info fields like first name, last name, email etc. Could anyone please suggest me how can I implement it in Craft.﻿

**Tags:** form

> **Comments:**
> **username_1**: Hi Bhashakar, welcome to Craft Stack Exchange! This question is very broad, can you please edit to make it more specific? It would help to know where you are starting from... what have you already tried?  

---

## 1 answers

### Answer by username_2 on 2014-10-04. Score: 3

It depends to some extent whether the form is a login/registration form (to a user account) or just an information form, that you are saving in the database.
If the resources page is restricted and requires login, then you should place {% requireLogin %} at the top of your resources template. If anyone requests this page they will automatically be redirected to the login page, and after a successful login, will be routed back to the original request, which was the resources page. The login page can have a link to 'create account' with the additional fields you need, if they don't already have one.
If it is just an information form and not for login then you can simply create a form with the required fields. Submit the form using action/saveEntry along with a hidden field called redirect as explained here.

    
    
    ...


This is not secure however. If you need to make certain that they just don't go straight to the resources page without filling out the form, then you can test for the existence of an entry.id on the resources page (which is what is returned from a successful entries/saveEntry), and redirect them back to the form again if not defined. However, this would make the resources page viewable only once (unless you set a cookie or store session data, etc). And they would have to fill out the form every time they wanted to view it, which doesn't sound like what you want. In which case go with the login route above.
There are example templates for login, user registration, and others (more links at bottom left of those pages).


---

