/* CODE TO SET THE COOKIE */
This set of code is all responsible for the setting of the cookie.

// PHP / HTML - This is the form code
<form id="yourdesiredid" action="http://theplaceyousendyourdata" method="POST">
<input name="Firstname" type="text" />
<input name="Email" type="text" />
<input type="submit" value="Submit" />
</form>

// Javascript - This is the code that pings the PHP file that will set the cookie below
<script type="text/javascript">
$ = jQuery;
$('#yourdesiredid').submit(function() {
$.post("http://theeffortlessmethod.com/gpscookie.php", { name: "Test" } );
});
</script>

// PHP File - This code is located in its own file and gets posted to when the form is submitted.
<?php
if(isset($_COOKIE['gpsoptin'])){
//do nothing
}else{
setcookie('gpsoptin', 'set', time()+(60*60*24*365)); //cookie expires in one year
}
?>




/* CODE RESPONSIBLE FOR THE REDIRECT */
This set of code is responsible for checking the cookie and displaying the page.
As it was difficult to find out which page was executing the header with doctype code, I couldnt use the traditional php header(yoururl) redirect. Instead, I used a combination of PHP and Javascript to accomplish the same desired result.

<?php
// PHP - This set of code checks to see if it is one of the protected pages using the WordPress is_page function... then it finally checks to see if the cookie is present. If this is all true, it will execute the javascript below.
if ( ( is_page('food-for-the-body') || is_page('food-for-the-mind') || is_page('food-for-the-soul') || is_page('food-for-the') ) && !isset($_COOKIE["gpsoptin"])) { ?>

// JavaScript - This code will redirect to your desired url if the above code is found to be true.
<script type="text/javascript">
window.location = "http://yourdesiredredirecturl";
</script>

<?php
exit;
}
?>