Question: My html code which receives the string:

```
<!DOCTYPE html>
<head>
    <title>title</title>
</head>
<body>
    <font face="Segoe UI" siz ="3">
    <form action="process.php" action="post">
    Suggestion: <input type="text" name="sgst" autocomplete="off">
    <input type="submit">
</form>
</font>
</body>
</html>

```

My PHP which processes it: (process.php)

```
<?php
    if ($_POST["sgst"]=="john") {
        echo "john";
    } else {
        echo "someone";
    }
?>

```

I am getting the error

> 
> Notice: Undefined index: sgst in C:\xampp\htdocs\test\process.php on line 2
> 
> 
> 

Can anyone tell me what is causing the error?

Answer: 
use isset 

```
if(isset($_POST["sgst"]=="john")){

} 

```
**it shows undefined because at first the value is not initialized** 

use `isset()` inorder to check for value declared or not then it wont show error...

**try this i have changed**

```
<?PHP 
if (isset($_POST["sgst"])
{
   if ($_POST["sgst"]=="john") {
    echo "john";
   } else {
    echo "someone";
   }
}
?>

```