To redirect if no parameters

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
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 ($dbf=="")
{header("Location: /");exit()}
But it do not work
Why please?

Re: To redirect if no parameters

Robertu kirjoitti:


$HTTP_POST_VARS and $HTTP_GET_VARS are deprecated. It means do not use  
these anymore. These will not be avaialable in future versions of php,  
instead use $_POST and $_GET.

Quoted text here. Click to load it

Try not to write everything on one line so you'll see better what is  
wrong. It's easier to read.

if ($dbf=="") {
    header("Location: /");


"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze

Re: To redirect if no parameters

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

Quoted text here. Click to load it

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

use $_POST, $_GET and $_SERVER['REQUEST_METHOD'] instead.


Site Timeline