1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>Document</title>
8</head>
9<body>
10 <form action="" method="post">
11 <h1>ISSET Demo</h1>
12 <input type="submit" value="Click here" name="btn1">
13 </form>
14</body>
15</html>
16<?php
17if(isset($_POST['btn1']))
18{
19 echo "button was set!";
20}
21?>
1
2<?php
3
4$var = '';
5
6// This will evaluate to TRUE so the text will be printed.
7if (isset($var)) {
8 echo "This var is set so I will print.";
9}
10
11// In the next examples we'll use var_dump to output
12// the return value of isset().
13
14$a = "test";
15$b = "anothertest";
16
17var_dump(isset($a)); // TRUE
18var_dump(isset($a, $b)); // TRUE
19
20unset ($a);
21
22var_dump(isset($a)); // FALSE
23var_dump(isset($a, $b)); // FALSE
24
25$foo = NULL;
26var_dump(isset($foo)); // FALSE
27
28?>
29
30