The Great Unwashed Posted March 20, 2009 Share Posted March 20, 2009 Hi there, I recently came across a problem that I couldn't solve. This is not surprising as I am not that good in PHP, so please bear with me if this sounds dumb. I have written two scripts: one which takes information from a form a user fills in (mailform.php), and one which inserts a matching user into a PHPBB forum database (insertuser.php). The two scripts need to be in completely different directories. I am trying to get the mailform.php script to pass values to the insertuser.php script. From what I have read the easiest way to do this would be to pass them in the URL. So when I tried this: header( "Location:http://www.website.com/forum/insertuser.php?username=helloworld&password=helloworld&[email protected]" ); I got this error message: Warning: Cannot modify header information - headers already sent by... (etc) I know that changing the page location using the header works, is it simply a matter of that I am not escaping my characters properly? Or can I not pass variables through the header location? Or am I doing something else horribly wrong? To be honest I'm not even sure this is the best way to do it. Like I say, I'm pretty amateurish with this stuff, so if there's an easier way to get PHP to pass values around between directories like this I'd be interested to know what it is. (Also, I know this isn't a secure way of adding new users, but this is a closed internal environment I'm developing for and security is not an issue at the moment.) Thanks very much everyone, I really appreciate any thoughts. Link to comment https://forums.phpfreaks.com/topic/150261-solved-passing-values-from-one-php-file-to-another-through-the-url/ Share on other sites More sharing options...
Lodius2000 Posted March 20, 2009 Share Posted March 20, 2009 more code would help please use code tags, its the '#' button above all the smilies Link to comment https://forums.phpfreaks.com/topic/150261-solved-passing-values-from-one-php-file-to-another-through-the-url/#findComment-789087 Share on other sites More sharing options...
The Great Unwashed Posted March 20, 2009 Author Share Posted March 20, 2009 Hrmm I'm not sure what else I can add. I have already used the relevant code snippets. The two scripts work fine on their own when I test them directly. The problem is passing the code between them. If you could point out what you are not clear on I will be happy to try and expand my problem? Link to comment https://forums.phpfreaks.com/topic/150261-solved-passing-values-from-one-php-file-to-another-through-the-url/#findComment-789092 Share on other sites More sharing options...
corbin Posted March 20, 2009 Share Posted March 20, 2009 http://www.phpfreaks.com/forums/index.php/topic,37442.0.html Link to comment https://forums.phpfreaks.com/topic/150261-solved-passing-values-from-one-php-file-to-another-through-the-url/#findComment-789094 Share on other sites More sharing options...
The Great Unwashed Posted March 20, 2009 Author Share Posted March 20, 2009 Thanks corbin! (Was that always Stickied and I'm just blind, or did it only just go up? Swear I didn't see it before, I do apologise) Link to comment https://forums.phpfreaks.com/topic/150261-solved-passing-values-from-one-php-file-to-another-through-the-url/#findComment-789095 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.