corrupshun Posted April 13, 2010 Share Posted April 13, 2010 process.php: <?php $email = $_POST['email']; header('Location: http://www.example.com'); ?> I would want process.php to take the $email variable and pass it to another page as a POST. Is this possible in conjunction with header()? Or is there another way I could do it? Quote Link to comment https://forums.phpfreaks.com/topic/198330-is-there-a-way-to-submit-variables-to-another-page-without-a-form/ Share on other sites More sharing options...
Ken2k7 Posted April 13, 2010 Share Posted April 13, 2010 Is it a page within the same domain? If yes, use Sessions. If no, use cURL. Quote Link to comment https://forums.phpfreaks.com/topic/198330-is-there-a-way-to-submit-variables-to-another-page-without-a-form/#findComment-1040628 Share on other sites More sharing options...
corrupshun Posted April 13, 2010 Author Share Posted April 13, 2010 I can't use sessions (as you stated), so can anbody tell me how to do this in cURL? I've always heard of it but never looked into it. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/198330-is-there-a-way-to-submit-variables-to-another-page-without-a-form/#findComment-1040865 Share on other sites More sharing options...
JonnoTheDev Posted April 13, 2010 Share Posted April 13, 2010 $_GET <?php $email = $_POST['email']; header('Location:http://www.example.com/?email='.urlencode($email)); exit(); ?> <?php // http://www.example.com/index.php $email = urldecode($_GET['email']); ?> Quote Link to comment https://forums.phpfreaks.com/topic/198330-is-there-a-way-to-submit-variables-to-another-page-without-a-form/#findComment-1040868 Share on other sites More sharing options...
ChemicalBliss Posted April 13, 2010 Share Posted April 13, 2010 Neil stated the easiest/simplest method, using cURL you can actually emulate POSTing of form elements. For info on CURL: http://uk2.php.net/manual/en/function.curl-init.php If you read through tyhe comments you will get tons of examples, and info if its not working like you want. Also, for POST, you need to use the "CURLOPT_POST" constant. I would reccommend using google for: "cURL PHP Tutorial". -CB- Quote Link to comment https://forums.phpfreaks.com/topic/198330-is-there-a-way-to-submit-variables-to-another-page-without-a-form/#findComment-1040883 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.