Skip to main content
Participant
November 27, 2007
Answered

redirection using header not working..

  • November 27, 2007
  • 5 replies
  • 415 views
Hi,
I've created a simple insert page and after insert i want it to be redirected to another page which has list of entries.
Somehow the header redirection is not working. I tried site relative name in the after insert go to option and then gave tried the full path name but no relief. I tried the redirect at the top of the page(plain redirection as soon as the page is loaded) and it worked. I have attached the code. Can some one spot what am i missing here?
This topic has been closed for replies.
Correct answer Vijaikumar Ramasamy
I finally had time to work on this. The header already sent was solved by including the contents of the file my_db.php instead directly in the file. Somehow a white space crops up when virtual is used..

5 replies

Inspiring
December 5, 2007
Vijaikumar Ramasamy wrote:
> I finally had time to work on this. The header already sent was solved by
> including the contents of the file my_db.php instead directly in the file.
> Somehow a white space crops up when virtual is used..

Your solution definitely works, which is the main thing. However,
virtual() won't insert whitespace unless it already exists.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Vijaikumar RamasamyAuthorCorrect answer
Participant
December 5, 2007
I finally had time to work on this. The header already sent was solved by including the contents of the file my_db.php instead directly in the file. Somehow a white space crops up when virtual is used..
Inspiring
November 27, 2007
Vijaikumar Ramasamy wrote:
> Somehow the header redirection is not working.

The most common problem with PHP failing to redirect a page is the
"headers already sent" error. It's frequently caused by an extra blank
line in an include file. Make sure there is no space or extra lines
before the opening PHP tag. Also check the include file (my_db.php) to
make sure there is no blank space or extra lines before the opening PHP
tag and after the closing PHP tag.

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Participant
November 27, 2007
The page is not redirected it stays in the same page after the insert action.
the page is in the location << http://localhost/mysite/create_blog_entry.php?>>

after the submit form it should be redirected to the << http://localhost/mysite/blog_view.php>>--expected result

but the result is
<< http://localhost/mysite/create_blog_entry.php?>>
I tried the exit function after the header and i got connection reset error..
<<The connection to the server was reset while the page was loading.>>
Inspiring
November 27, 2007
.oO(Vijaikumar Ramasamy)

> I've created a simple insert page and after insert i want it to be redirected
>to another page which has list of entries.
> Somehow the header redirection is not working.

What does "not working" mean? What result do you get? Any error message?
A blank page?

>I tried site relative name in
>the after insert go to option and then gave tried the full path name but no
>relief.

The URL for the redirect must be absolute, not relative.

>I tried the redirect at the top of the page(plain redirection as soon
>as the page is loaded) and it worked. I have attached the code. Can some one
>spot what am i missing here?

One thing would be to add an exit() after the header() call to ensure
that the script stops there.

Micha