Step: 1 Code: Client's side

<html>
<title>form: check_empty_isset.htm </title>
<body text="#000080" bgcolor="#F7F0D7">
Determines if a variable is set and is not NULL.
<table border="1" cellpadding="0" cellspacing="0"
style="border-collapse: collapse" bordercolor="#111111" width="320">
<tr>
<td width="320">Please enter your name</td>
</tr>
<tr>
<td >
<form method="POST" action="check_empty_isset.php">
<input type="text" name="fname" size="20"><br>
<input type='hidden' name='insert_1' id='in_post_1'
value='in_post_1' />
<input type="submit" value="Submit" name="B1"></p>
</form>
<p> </td>
</tr>
<tr>
<td >Often we need to check the existence of a variable before
initialization; we may use isset function</td>
</tr>
</table>
</body>
</html>
code: Server side

<?php
$fname = $_POST['fname'];
// Evaluates as true because $var is set
if (isset($fname))
{
echo 'you entered'. $fname.'<br/>';
}
else
{
echo "you entered but value was not accepted";
die($fname."bye");
}
// say here we were expecting a value from a client
// and it was not there
if (isset($lname))
{
echo 'you entered'. $fname.'<br/>';
}
else
{
echo "you entered but value was not accepted <br/>";
die($fname."bye bye John Doe");
}
?>