Re: php redirection..

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 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


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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux