SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Addict
    Join Date
    Oct 2004
    Location
    United Kingdom
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Methods needed for showing users content only after form completion?

    I have some content (a certain webpage) that I wish to give to my users only after they have filled in a form (account not required), and I would like some suggestions regarding any appropriate methods to do this.

    Upon submission of the form I could automatically email the user a link to the content.
    or I could forward the user straight to the page.....
    or I could???

    Ideally I would want a page that is as difficult to get to as possible for those users who have not filled in the form. I would probably exclude a password approach.

  2. #2
    SitePoint Zealot Servyces's Avatar
    Join Date
    Jun 2007
    Location
    The Netherlands
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Another idea is to link the form to the database. Once they completed the form, store their IP address in your db and upon requesting the "locked" page, have a query check if their IP is in the database.

    Or have a cookie set after the form is completed and only allow the content to be viewed when the cookie exists.

    That's just some ideas.
    Last edited by Servyces; Jun 13, 2007 at 10:30.
    Servyces.com
    Where itís all about you.
    Your partner in online solutions.
    Visit our website at http://www.servyces.com/

  3. #3
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,804
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    set a session variable that is filled when the form is submitted, check for that variable on the content page. If it's not there, redirect them to another page.

    PHP Code:
    session_start();
    if(isset(
    $_POST['form_submission'])) {

    // process the form
    $_SESSION['completed_form'] = 1;

    header("Location: private_content.php");
    exit();

    and on private_content.php
    PHP Code:
    if($_SESSION['completed_form'] != 1) {
    header("Location: go_away.php");
    exit();

    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,034
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)

    required form

    Just to be clear, this form needs to be filled out each visit?

  5. #5
    SitePoint Addict Iceman90's Avatar
    Join Date
    Mar 2006
    Location
    Calgary, Alberta, Canada
    Posts
    391
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use a cookie (if you want the user to be able to visit the page more than once) or a session for a single visit.

  6. #6
    SitePoint Addict
    Join Date
    Oct 2004
    Location
    United Kingdom
    Posts
    346
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok thanks a lot guys that's great help. I wanted users to be able to access it on more than one visit and so I went for the Cookie option.

    Thanks!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •