Re: [PHP] redirect using php
On Tuesday 04 April 2006 22:27, Brady Mitchell wrote: -Original Message- In JSP I have access to a function called sendRedirect() to send a user from one page to another, usually after some processing completed. Is there a similar function in PHP? Take a look at the header() function. http://php.net/header To redirect you can use: header(Location: http://www.example.com/;); You can also use something like: echo meta http-equiv=\Refresh\ content=\0;url=$from_page\; depending on your needs. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
Or with javascript: ? ... ? script language=JavaScript !-- document.location = 'http://where.to.go.com/example.php?param1=?=$param1?'; //-- /script ? ... ? PS: Sorry Mark... Andy Mark Kelly wrote: On Tuesday 04 April 2006 22:27, Brady Mitchell wrote: -Original Message- In JSP I have access to a function called sendRedirect() to send a user from one page to another, usually after some processing completed. Is there a similar function in PHP? Take a look at the header() function. http://php.net/header To redirect you can use: header(Location: http://www.example.com/;); You can also use something like: echo meta http-equiv=\Refresh\ content=\0;url=$from_page\; depending on your needs. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
Andrei wrote: document.location = 'http://where.to.go.com/example.php?param1=?=$param1?'; Wasn't it - document.location.href ='www.example.com'; o_O ? Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
It works with document.location = '...'; too. I use only this method and it worked on all browsers... Andy Barry wrote: Andrei wrote: document.location = 'http://where.to.go.com/example.php?param1=?=$param1?'; Wasn't it - document.location.href ='www.example.com'; o_O ? Barry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
Mark Kelly wrote: You can also use something like: echo meta http-equiv=\Refresh\ content=\0;url=$from_page\; There's no need to use a meta tag to mimic HTTP headers. PHP provides the header() function. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
On Wednesday 05 April 2006 13:55, Chris Shiflett wrote: Mark Kelly wrote: You can also use something like: echo meta http-equiv=\Refresh\ content=\0;url=$from_page\; There's no need to use a meta tag to mimic HTTP headers. PHP provides the header() function. I have been using that method when I got part-way through some processing that produces output, and hit something that requires a redirect. As I understand it headers are no use to me here. I'm very much a beginner, so if this is the wrong way to do this, I'd appreciate pointers. Thanks for the reply, either way. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirect using php
If it helps here's the code I use to redirect ?php function chrome_redirect($url) { // redirect the page if (headers_sent()) { // perform JS redirect echo 'script type=text/javascript language=javascript!-- document.location.href=\'' . $url . '\'; // --/script'; } else { // no headers sent... much nicer header redirect header('location: ' . $url); die(); } } ? HTH Dan - Dan Parry Senior Developer Virtua Webtech Ltd http://www.virtuawebtech.co.uk -Original Message- From: Mark Kelly [mailto:[EMAIL PROTECTED] Sent: 05 April 2006 14:19 To: php-general@lists.php.net Subject: Re: [PHP] redirect using php On Wednesday 05 April 2006 13:55, Chris Shiflett wrote: Mark Kelly wrote: You can also use something like: echo meta http-equiv=\Refresh\ content=\0;url=$from_page\; There's no need to use a meta tag to mimic HTTP headers. PHP provides the header() function. I have been using that method when I got part-way through some processing that produces output, and hit something that requires a redirect. As I understand it headers are no use to me here. I'm very much a beginner, so if this is the wrong way to do this, I'd appreciate pointers. Thanks for the reply, either way. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1454 (20060321) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
At 11:21 PM +0200 4/4/06, Schalk wrote: Greetings All, In JSP I have access to a function called sendRedirect() to send a user from one page to another, usually after some processing completed. Is there a similar function in PHP? After processing a form and sending the data via email, I need to redirect them to another page. I currently use a method of merely replacing the form with some 'thank you' text after submitting the form, I prefer this but, the client wants me to redirect to another page. All help appreciated. Thanks! -- Kind Regards Schalk Neethling Schalk: Try: http://www.weberdev.com/header tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
Mark Kelly wrote: You can also use something like: echo meta http-equiv=\Refresh\ content=\0;url=$from_page\; There's no need to use a meta tag to mimic HTTP headers. PHP provides the header() function. I have been using that method when I got part-way through some processing that produces output, and hit something that requires a redirect. As I understand it headers are no use to me here. You're still using a Refresh header. The difference is that you're using a meta tag to mimic the header (e.g., http-equiv). Using meta: meta http-equiv=Name content=Value / Using header(): ?php header('Name: Value'); ? Hope that helps. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
Function that will work also, when JS is not activate and headers are allready send :) : ?php function chrome_redirect($url) { // redirect the page if (headers_sent()) { // perform JS redirect echo 'script type=text/javascript language=javascript !-- document.location.href=\'' . $url . '\'; // -- /script noscript meta http-equiv=refresh content=0; url='$url' / /noscript'; } else { // no headers sent... much nicer header redirect header('location: ' . $url); die(); } } ? on Wednesday 05 April 2006 15:30, Dan Parry wrote: If it helps here's the code I use to redirect ?php function chrome_redirect($url) { // redirect the page if (headers_sent()) { // perform JS redirect echo 'script type=text/javascript language=javascript!-- document.location.href=\'' . $url . '\'; // --/script'; } else { // no headers sent... much nicer header redirect header('location: ' . $url); die(); } } ? HTH Dan - Dan Parry Senior Developer Virtua Webtech Ltd http://www.virtuawebtech.co.uk -Original Message- From: Mark Kelly [mailto:[EMAIL PROTECTED] Sent: 05 April 2006 14:19 To: php-general@lists.php.net Subject: Re: [PHP] redirect using php On Wednesday 05 April 2006 13:55, Chris Shiflett wrote: Mark Kelly wrote: You can also use something like: echo meta http-equiv=\Refresh\ content=\0;url=$from_page\; There's no need to use a meta tag to mimic HTTP headers. PHP provides the header() function. I have been using that method when I got part-way through some processing that produces output, and hit something that requires a redirect. As I understand it headers are no use to me here. I'm very much a beginner, so if this is the wrong way to do this, I'd appreciate pointers. Thanks for the reply, either way. Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1454 (20060321) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
On Wednesday 05 April 2006 14:33, Chris Shiflett wrote: Mark Kelly wrote: You can also use something like: echo meta http-equiv=\Refresh\ content=\0;url=$from_page\; There's no need to use a meta tag to mimic HTTP headers. PHP provides the header() function. I have been using that method when I got part-way through some processing that produces output, and hit something that requires a redirect. As I understand it headers are no use to me here. You're still using a Refresh header. The difference is that you're using a meta tag to mimic the header (e.g., http-equiv). I understand that. I'm sorry, I am obviously not making myself clear... The php manual page tells me that I can't use header() after any output has been sent, thus making it useless in my (obviously badly explained) case above. What happens in my app is: the data processing is in several discrete sequential stages, each one echoing status to the user. When it hits something that requires additional pre-processing by a different page, I use the http-equiv redirect with a 3 second delay so the user can read the message telling them what is going on. Am I correct that header() is no use for this, and is there a correct way to achieve what I describe? I'm a bit concerned that my ignorance may have led me to do this wrong - this is my first php app. Also, thanks to all the folk suggesting javascript, but this is an internal app, and policy has javascript turned off on all browsers. Thanks again, Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
Andrei wrote: It works with document.location = '...'; too. I use only this method and it worked on all browsers... Assuming the end user has JS turned on. JS and Meta Refreshes are not acceptable when you need to be sure the redirect works. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[Fwd: Re: [PHP] redirect using php]
Andrei wrote: It works with document.location = '...'; too. I use only this method and it worked on all browsers... Assuming the end user has JS turned on. JS and Meta Refreshes are not acceptable when you need to be sure the redirect works. Depends on your user target... I generally suppose the users using my code enabled JS on their browsers. If they didn't too bad. I can't code everything judging there are ppl that do restrictions on their browsers. Andy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [Fwd: Re: [PHP] redirect using php]
Thanks everyone for your help. In the end the simplest one that works for this specific project was: echo meta http-equiv=\Refresh\ content=\0;url=$from_page\; Andrei wrote: Andrei wrote: It works with document.location = '...'; too. I use only this method and it worked on all browsers... Assuming the end user has JS turned on. JS and Meta Refreshes are not acceptable when you need to be sure the redirect works. Depends on your user target... I generally suppose the users using my code enabled JS on their browsers. If they didn't too bad. I can't code everything judging there are ppl that do restrictions on their browsers. Andy -- Kind Regards Schalk Neethling Web Developer.Designer.Programmer.President Volume4.Business.Solution.Developers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirect using php
http://uk.php.net/manual/en/function.header.php --- http://chrome.me.uk -Original Message- From: Schalk [mailto:[EMAIL PROTECTED] Sent: 04 April 2006 22:21 To: php-general@lists.php.net Subject: [PHP] redirect using php Greetings All, In JSP I have access to a function called sendRedirect() to send a user from one page to another, usually after some processing completed. Is there a similar function in PHP? After processing a form and sending the data via email, I need to redirect them to another page. I currently use a method of merely replacing the form with some 'thank you' text after submitting the form, I prefer this but, the client wants me to redirect to another page. All help appreciated. Thanks! -- Kind Regards Schalk Neethling Web Developer.Designer.Programmer.President Volume4.Business.Solution.Developers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1471 (20060404) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] redirect using php
-Original Message- In JSP I have access to a function called sendRedirect() to send a user from one page to another, usually after some processing completed. Is there a similar function in PHP? Take a look at the header() function. http://php.net/header To redirect you can use: header(Location: http://www.example.com/;); Brady -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] redirect using php
Brady Mitchell wrote: -Original Message- In JSP I have access to a function called sendRedirect() to send a user from one page to another, usually after some processing completed. Is there a similar function in PHP? Take a look at the header() function. http://php.net/header To redirect you can use: header(Location: http://www.example.com/;); Brady Thanks everyone, I will give this a go. -- Kind Regards Schalk Neethling Web Developer.Designer.Programmer.President Volume4.Business.Solution.Developers -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Redirect using PHP to a new browser window.
If the only thing you plan on doing after incrementing your counter is going to the new page, why not put the target="_blank" in the a tag that points to your script. Then you'll do your counter script and redirect when you're already in a new window. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]