This is Client-Side Validation. Validation is performed on the client machine web browsers.
Forms can be submitted to the web page itself using PHP. The main purpose of submitting forms to self is for data validation. Data validation means checking for the required data to be entered in the form fields.
EXAMPLE
<form action="<?=($_SERVER['PHP_SELF'])?>" method="POST">
<label>insert data</label>
<input type="text" name="somename">
<input type="submit" value="press">
</form>
<?php
$a=$_POST["somename"];
echo $a;
?>
result: