CoolAffiilate Posted August 29, 2007 Share Posted August 29, 2007 Hey Php Freaks! I need some help here. Im really new at php... so if anyone can point me in the right direction that would be great! Here is what I am looking for: A person signs up at my newsletter. Cool@cool.com. The newsletter script ads them to the database, then sends them to the subscribed page with the variable added to the query string: mynewsletter.com/subscribed.html?address=coolguys%email but what i need is to send them to a page that needs the variable mynewsletter.com/welcome.php?email= It will use the variable. So, i need a script that will read a query string, and convert it into a new URL... Anyone understand? Thanks! Quote Link to comment Share on other sites More sharing options...
annihilate Posted August 29, 2007 Share Posted August 29, 2007 I'm not too sure exactly what you are after, but if you want to read the parameters in the query string, on the page you can just do: $email_address = $_GET['email']; So on your welcome.php page, that bit of code will give you the value of the email address that is in the query string. Quote Link to comment Share on other sites More sharing options...
CoolAffiilate Posted August 29, 2007 Author Share Posted August 29, 2007 Thank you... But the problem is slightly different. What i need to do is capture the query string, and pass it on to a partner via URL. mine is: cool.com/welcome.php?address=emailaddy but they need notcool.com/welcome.php?email=emailaddy It needs to work similiar to a redirect. Quote Link to comment Share on other sites More sharing options...
annihilate Posted August 29, 2007 Share Posted August 29, 2007 Do you want an automatic redirection from your cool.com/welcome.php page to the nocool.com/welcome.php page or does a link need to be clicked first to go to the nocool.com site? Quote Link to comment Share on other sites More sharing options...
CoolAffiilate Posted August 29, 2007 Author Share Posted August 29, 2007 It needs to be a redirect. Quote Link to comment Share on other sites More sharing options...
annihilate Posted August 29, 2007 Share Posted August 29, 2007 On your welcome.php page: (needs to go before any output) $email_address = $_GET['address']; // email address passed in query string header("Location: http://www.notcool.com/welcome.php?email=".$email_address); // the redirect Are you doing anything else on the welcome.php page, or just the redirect, because if its just the redirect, it seems a bit redundant. You might as well handle the redirect beforehand where you add the email address to the database etc. Quote Link to comment Share on other sites More sharing options...
CoolAffiilate Posted August 29, 2007 Author Share Posted August 29, 2007 Wow, thank you! I would just put the <?php and close it, then done right? Quote Link to comment Share on other sites More sharing options...
annihilate Posted August 29, 2007 Share Posted August 29, 2007 That's right. Could also add an exit() statement just in case something goes wrong. <?php $email_address = $_GET['address']; // email address passed in query string header("Location: http://www.notcool.com/welcome.php?email=".$email_address); // the redirect exit(); ?> Quote Link to comment Share on other sites More sharing options...
CoolAffiilate Posted August 29, 2007 Author Share Posted August 29, 2007 THANK YOU! I have been searching for hours how to do this. Its so simple. Agian, thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.