Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

redirection using header not working..

Community Beginner ,
Nov 27, 2007 Nov 27, 2007
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?
TOPICS
Server side applications
383
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Dec 05, 2007 Dec 05, 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..
Translate
LEGEND ,
Nov 27, 2007 Nov 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
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 27, 2007 Nov 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.>>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 27, 2007 Nov 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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 05, 2007 Dec 05, 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..
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Dec 05, 2007 Dec 05, 2007
LATEST
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/
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines