<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Title here!</title>
</head>
<body>
<?php
function display_welcome()
{
print("Welcome, ");
print($_POST['user_name']);
}
function display_empty_form()
{
print <<<_HTML_
<FORM method="post" action="$_SERVER[PHP_SELF]">
Eneter your name:<input type="text" name="user_name">
<br/>
<input type="submit" value="submit name">
</FORM>
_HTML_;
}
if($_POST['user_name'])
{
display_welcome();
}
else
{
display_empty_form();
}
?>
</body>
</html>
沒有留言:
張貼留言