What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How can I auto-populate, or set a cookie for returning vistors

    Asked by Lenny on July 09, 2012 at 03:07 PM

    Hi,

    I'd like to use your form to collect an email address, then redirect visitors to a video page.  My issue is dealing with returning visitors. They will not want to submit their email address each time they come back to the page.  I was planing to hide the form and the video player page in an iframe.  I'm not concerned with the redirected page being accessable to those who really want to find it.  I would just like to make it easy for returning vistors so they don't have to re-enter their email.

    From what I've seen so far, this app looks great!

    Thanks,

    Lenny

    Page URL:
    http://fullviewmedia.com/test/sig-12/form.html

  • Profile Image
    JotForm Support

    Answered by NeilVicente on July 09, 2012 at 07:01 PM

    Lenny,

    You will have to set a cookie on the user's browser once they reach the video page. Then, the form page will use a PHP script to determine if the cookie has been set or not.

    Here's the scenario:

    If the cookie exists, the user will automatically be redirected to the video page.

    Else, nothing will happen. The user will have to submit the form to get to the video page.

    I will try to come up with a PHP script if my time permits. In any case, here's a little manual that might help:

    http://php.net/manual/en/function.setcookie.php

  • Profile Image
    JotForm Support

    Answered by NeilVicente on July 09, 2012 at 08:24 PM

    Alright, assuming your server runs PHP, try this solution:

    Copy the codes below and insert it in your video page's source code (above everything else):

    <?php
    if(!isset($_COOKIE['formsubmitted'])) {
        setcookie("formsubmitted", '1');
    }
    ?>

    Then, insert the following codes in your form page's source code (replace the bolded URL with your video page's URL):

    <?php
    if(isset($_COOKIE['formsubmitted'])) {
        header('Location: http://www.example.com/myvideopage.php');
    }
    ?>