$id_subramura1=$row['id_subramura1'];
   
  $display_block.="<li><a href=\"".$_SERVER["PHP_SELF"]."?id_subramura1="
  .$id_subramura1."\">".$Denumire_Subramura1."</a></strong></li>";
        
        
      
 print_r($_GET);
 if($_GET["id_subramura1"] === "") echo "a is an empty string\n";
 if($_GET["id_subramura1"] === false) echo "a is false\n";
 if($_GET["id_subramura1"] === null) echo "a is null\n";
 if(isset($_GET["id_subramura1"])) echo "a is set\n";
 if(!empty($_GET["id_subramura1"])) echo "a is not empty";

How it possible to echo "a is null" when is null and nothing when it not null?
AND THE URL SHOW: http://localhost/prajituri/prima.php?id_subramura1=9

Recommended Answers

All 9 Replies

if(!isset($variable)) echo 'null';
or
if($variable) echo 'null';

Becareful using the second though, if the variable has a value of zero it will say null.

I just showed you.... If it is null, it will echo null. If it is not null, it won't echo anything.

I just showed you.... If it is null, it will echo null. If it is not null, it won't echo anything.

:) Your are right but this is my true problem. Even if the url has the get he is not showing me the content of the get like it empty but it not

if(!isset($variable)) {
echo 'null';
} else {
echo $variable;
}

just echo the variable.

Get rid of the parentheses.

still not working

What does your full code look like

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.