jeudi 16 juin 2016

$_REQUEST['action'] != 'foo' don't work in an if statement

I've following function:

public function output_berater(){
    if($_REQUEST["action"] != "berater_formular_suche" || $_REQUEST["action"] != "thema_formular_suche"){
        print_r($_REQUEST["action"]);           
    }
    return $output;
}

If I send a form with a hidden field berater_formular_suche or thema_formular_suche the print_r shouldn't be display on the screen.

I thought != say 'if not' ?!

Maybe there is some specials with $_REQUEST and if statements.

Can somebody explain me why my print_r is displaying?

Edit:

if I submit my form:

Output $_REQUEST

Array
(
    [action] => berater_formular_suche
    [berater] => klaus-testname
)

if I don't submit my form:

Output $_REQUEST

Empty array.

Aucun commentaire:

Enregistrer un commentaire