1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[WordPress] Need Solution to Problem

Discussion in 'Blogging' started by kzonlertsgo, Oct 24, 2011.

  1. kzonlertsgo

    kzonlertsgo Newbie

    Joined:
    Oct 7, 2010
    Messages:
    7
    Likes Received:
    0
    Home Page:
    Hey guys I've ran a couple blogs using wordpress so I have a pretty good idea of how everything works, but I need help with this.

    I am making a new site with a content locked email submission, where people can enter to have a chance at winning something. I found great plugins for the email submission and content locking, but once the page is unlocked, people can keep using the email submission.

    What can I do to create a "Thanks for Entering" page/message, and then send them back to the homepage after submitting their email? Keep in mind I need to be able to collect these email addresses to choose a winner.

    Thanks in advance.
     
  2. BluRoze

    BluRoze Registered Member

    Joined:
    Jun 15, 2011
    Messages:
    77
    Likes Received:
    13
    Location:
    USA
    Your "thank you" page could have code like this on it:

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Thank for your vote</title>
    <link rel="stylesheet" href="style.css" type="text/css" />
    <script type="text/javascript">
    window.onload = function() {
    /* set your parameters(
    number to countdown from,
    pause between counts in milliseconds,
    function to execute when finished
    )
    */
    startCountDown(6, 1000, myFunction);
    }
    function startCountDown(i, p, f) {
    // store parameters
    var pause = p;
    var fn = f;
    // make reference to div
    var countDownObj = document.getElementById("countDown");
    if (countDownObj == null) {
    // error
    alert("div not found, check your id");
    // bail
    return;
    }
    countDownObj.count = function(i) {
    // write out count
    countDownObj.innerHTML = i;
    if (i == 0) {
    // execute function
    fn();
    // stop
    return;
    }
    setTimeout(function() {
    // repeat
    countDownObj.count(i - 1);
    },
    pause
    );
    }
    // set it going
    countDownObj.count(i);
    }
    function myFunction() {
    window.location = "the url you're redirecting them to goes here"
    }
    </script>
    </head>
    <body>
    <div id="thank-message">
    <h1>Thanks for your vote!</h1>
    <p style="font-size: 14px; line-height: 1.3em;">please wait <span id="countDown" style="color:#FF0000">6</span> seconds as we count your vote and re-direct you to blah blah blah...</p>
    </div>
    </body>
    </html>

    That's some code I recieved as part of a PDF eCourse. You'll have to decipher it yourself, but it basically shows your visitor a message, then counts down, then redirects them to a page of your choice. You can probably use this somehow, if nobody has a better suggestion.