[email protected] Posted October 30, 2009 Share Posted October 30, 2009 Hi Everyone, I am a novice in PHP. Here I have 2 pages, one page with a textbox and button and other page which has code to redirect to another website with the post value as querystring. When I tried to print the post data in the second page after posting, it worked fine, but when I have the header function in the second page the application hangs. Below is the code from these pages First Page <html> <body> <form action="welcome.php" method="get"> Search Phrase: <input type="text" name="fname" /> <input type="submit" /> </form> </body> </html> Second Page <?php header( 'Location: http://www.google.com' ) ; ?> Since I have problem in redirecting, the second page does not have code to pass query string data. How can I get this working ? Regards SD [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/179583-redirect-not-working-after-making-a-postget/ Share on other sites More sharing options...
jmr3460 Posted October 30, 2009 Share Posted October 30, 2009 On your welcome.php you have blank spaces before your code. When you set a session or use the header function you have to do so before you put anything out to the browser. Any white space before the code will be put out to the browser first. Read this: http://us.php.net/manual/en/function.header.php If you still have problems make sure that your are saving the file without BOM. This is something that happened to me for the longest till I changed the way my text editor was saving my files. Link to comment https://forums.phpfreaks.com/topic/179583-redirect-not-working-after-making-a-postget/#findComment-947620 Share on other sites More sharing options...
[email protected] Posted October 30, 2009 Author Share Posted October 30, 2009 Hi, I changed the welcome.php page. But still it does not working. When I load this page directly it is getting redirected. regards SD [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/179583-redirect-not-working-after-making-a-postget/#findComment-947630 Share on other sites More sharing options...
Gayner Posted October 30, 2009 Share Posted October 30, 2009 [code] [/code] PLEZ>.. use those tags Link to comment https://forums.phpfreaks.com/topic/179583-redirect-not-working-after-making-a-postget/#findComment-947631 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.