Printing A Greeting Or Printing A Form

 
<?php
if ($_POST['user']) {
    print "Hello, ";
    print $_POST['user'];
    print "!";
} else {
    print <<<_HTML_
<form method="post" action="$_SERVER[PHP_SELF]">
Your Name: <input type="text" name="user">
<br/>
<input type="submit" value="Say Hello">
</form>
_HTML_;
}
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.