Using Isset() function in php

|
| By Webner

The Isset () Function:

The isset () function is used when we have to check whether a value in the variable is set or not. It returns false when variable contains null values.

For Example, values are stored in a session so that it can have access to another web page.

Code:

<?php
session_start();
$_SESSION["userid"] = "1001";
$_SESSION["flag"] = "true";

?>

Now we check whether the session values are set or not:

<?php
if(isset($_SESSION["userid"] )and $_SESSION["flag"] == "true")
{
echo ”userid”.$_SESSION["userid"];
echo ”flag”.$_SESSION["flag"];
}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *