<? if($username){ echo "your name is $username !!! <br>"; } else { ?> <form action="<?= $PHP_SELF ?>" method="post"> Name: <input type="text" name="username"><br> <input type="submit"> </form> <? } ?>