I want to send a post request and get an echo from a php file. But i cannot find my mistake, always get a notice:undefined index...

please not jquery...

```
<form id="register" method="POST" action="register-action.php">

    <input type="text" name="first_name" placeholder="Onoma"><br>
    <input type="text" name="last_name" placeholder="Epitheto"><br>
    <input type="text" name="mail" placeholder="E-mail"><br>
    <input type="password" name="pass" placeholder="password"><br>

    <select name="eidikotita_id">
        <?php while($eid = $eidikotites->fetch( PDO::FETCH_ASSOC )):
            echo "<option value={$eid['id_eidikotitas']}>{$eid['titlos']}</option>";
        endwhile; ?>
    </select>

    <input type="submit" value="Register"><br>
</form>

```

///////////////////////////////////////////////////////////////

```
var mail_input = document.querySelector("#registerinput[name='mail']").value;
alert(mail_input);
document.querySelector("#register input[name='first_name']").focus();
document.querySelector("#register input[name='mail']").onblur = function() {

var request = new XMLHttpRequest();//instantiate an XMLHttpRequest object
request.open("POST", "register-action.php", true);//Specifying the Request
request.setRequestHeader("Content-Type", "text/plain");//POST requests,for example, need a “Content-Type” header
request.send(mail_input);//specify the optional request body. GET requests never have a body, so you should pass null or omit the argument.
};

```

/////////////////////////////////////////////////////////////////////////////

```
<?php 
echo $_POST['mail'];
?>

```