Re: [PHP] php redirection..



bruce wrote:
hey stut...

Please don't reply to me directly, always include the mailing list.

thanks for the reply... i did get some output...

i also have a question as to why i couldn't get it to work when i used
'header (foo.php)'

1) The correct way to redirect using the header function is header('Location: http://domain.com/foo.php'); Note the absolute URL.
2) Using header will definitely not display any output from the page.

i did a 'ob_end_flush()' at the start, followed by a 'header()' at the end,
but the header didn't seem to function as i though it should.

I suggest you read about the header function in the manual (http://php.net/header) - you clearly don't have any idea what it does.

given that the ultimate information that i'm going to want to display will
be dynamic. some times it might be 5 lines, others 100, others 50...

i had hoped that i could somehow display the content, wait a few seconds,
and then do an auto redirect...

Like I said in my first reply, Google for the Javascript function settimeout - that's what you need.

any thoughts/comments...

I have lots of comments. Thoughts are less common but they do occasionally happen.

-Stut

-----Original Message-----
From: Stut [mailto:stuttle@xxxxxxxxx]
Sent: Tuesday, December 12, 2006 9:21 AM
To: bedouglas@xxxxxxxxxxxxx
Cc: php-general@xxxxxxxxxxxxx
Subject: Re: [PHP] php redirection..


bruce wrote:
i want to be able to display some text/content and to then redirect the
user
to another page.

basically:

cat.php
-echo " test content<br>"
-echo " more test content<br>"

//redirect user
echo"
<script>
location.href='foo.php';
</script>
";

---------------
foo.php
-echo "i'm here"


should be pretty simple...

however, in my test, without the script/location.href i display the
content
ok. when i add the script/location.href, i get redirected, but the content
is never displayed...

any thoughts/samples/pointers on what might be going on, and how this
should
really be accomplished..

to be honest, i'm embarrassed to even be raising this here!!

And so you should be what with it being a Javascript question and this
being a PHP list.

Anyhoo, I don't get your confusion. The browser will run the script as
it loads it from your site. Ergo, it redirects before it displays what
you have output. I suggest you Google for examples of the settimeout
Javscript function - that's what you need to delay the redirect.

-Stut

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

.



Relevant Pages

  • Re: Post with redirect?
    ... you made it about javascript, ... He wanted a way to redirect a port with data to an external site and I gave it to him. ... And you still haven't showed us how to do a redirect with post values in PHP. ... the only thing jerry got right is that it would be a lot of work. ...
    (comp.lang.php)
  • Re: Post with redirect?
    ... redirection...and how to do a post from php (which you said was ... Oh, so you aren't even as good as a script kiddie, huh? ... I said it was impossible to redirect from PHP. ... Now who's backpeddling, troll? ...
    (comp.lang.php)
  • Re: Post with redirect?
    ... He wanted a way to redirect a port with data to an external site ... posting certain inputs, with the 3rd party server as the target. ... i made no claim other than you can use just php to get the job done. ... only thing jerry got right is that it would be a lot of work. ...
    (comp.lang.php)
  • Re: Post with redirect?
    ... How can I force a POST but actually redirect the user as well ... and it can't be done with PHP. ... thing jerry got right is that it would be a lot of work. ... Hi Steve, ...
    (comp.lang.php)
  • Re: Post with redirect?
    ... I am using an online merchant provider and I must post certain ... How can I force a POST but actually redirect the user as well like ... and it can't be done with PHP. ... that's just another helpful 'golden nugget' from jerry stuckle. ...
    (comp.lang.php)