I am trying to figure out the best way to do this and probably totally over thinking it.
I need users to submit their email before they can get the page contents.
they don't need to confirm at this point just submit any email. So I created a simple form with an email field and submit it to my process page using "POST"
However, I need them to be redirected to a dynamic url after submitting their email.
So I want to be able to put a variable in the url to the page I want to redirect to like this:
http://myurl.com/provide_email.php?url=newpage.html
On page provide_email.php I put :
<?php
session_start();
session_register('url');
$_SESSION['url'] = $_GET['url'];
?>
and echo the ouput on the same page (just to test it). So, on the same page it shows:
newpage.html
Then on my process.php page I put:
<?php
session_start();
$dynamicurl = $_GET['url'];
if(empty($_GET))
echo "No GET variables";
else
print_r($_GET);
$host = $_SERVER['HTTP_HOST'];
$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\');
$extra = 'folder1/folder2/';
header("Location: http://$host$uri/$extra/".$dynamicurl);
?>
However every time I submit the page it will not redirect to the url with the $dynamicurl variable.
I have also tried :
header("Location: http://$host$uri/$extra/$dynamicurl");
What am I doing the wrong?
The url has to be dynamic because I am creating the pages from a cms that ultimately the user will go to. I just want them to have to submit an email before they can get to each unique page.
$dynamicurl = $_GET['url'];why? you were trying to save the data into session variable, why are trying to get something from the query?session_registeris DEPRECATED since php 5.3http://$host$uri/$extra/".$dynamicurlactually results in?