Redirect not working after making a POST/GET

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sudheepphp
Forum Newbie
Posts: 2
Joined: Fri Oct 30, 2009 12:04 am

Redirect not working after making a POST/GET

Post by sudheepphp »

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
User avatar
akuji36
Forum Contributor
Posts: 190
Joined: Tue Oct 14, 2008 9:53 am
Location: Hartford, Connecticut

Re: Redirect not working after making a POST/GET

Post by akuji36 »

Hello

take a look at this:

http://sitening.com/blog/redirect-after ... rocessing/

thanks

Rod
sudheepphp
Forum Newbie
Posts: 2
Joined: Fri Oct 30, 2009 12:04 am

Re: Redirect not working after making a POST/GET

Post by sudheepphp »

Hi Rod,

thanks for the reply. I followed the link that you gave me and it helped !!.

Regards
SD
Post Reply