You are here: Re: To redirect if no parameters « PHP Programming Language « IT news, forums, messages
Re: To redirect if no parameters

Posted by Schraalhans Keukenmeester on 05/19/07 07:31

At Sat, 19 May 2007 07:02:15 +0000, Robertu let his monkeys type:

> Hi at all
> I have a php page where I display mysql table datas
> if the user call the page without one or more parameters I'ld want to
> redirect it to another page
> Therefore I wrote
> if ($REQUEST_METHOD=="POST") {
> $HTTP_STR=$HTTP_POST_VARS;
> }else{
> $HTTP_STR=$HTTP_GET_VARS;
> }
> while(list($chiave,$valore)=each($HTTP_STR))
> {
> }
> if ($dbf=="")
> {header("Location: http://www.pippo.es/");exit()}
> But it do not work
> Why please?
> regards

In your posted code the while loop does nothing, and I wonder where $dbf
gets its value. Just a typo here or actual code?

Or have you -by chance- sent any output to the browser on this page
BEFORE sending the location header? (You should not, as it forces a header
to be sent already).

Also, $HTTP_POST_VARS, $HTTP_GET_VARS and $REQUEST_METHOD are deprecated,
use $_POST, $_GET and $_SERVER['REQUEST_METHOD'] instead.

HTH
Sh.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация