Create HTML Form That Calls Itself in PHP

Description

The following code shows how to create HTML Form That Calls Itself.

Example


<html>/*from w  ww.  java2  s  .c o m*/
<body>
<div>
<?php
if ( ! empty( $_POST['guess'] ) ) {
    print "last guess: ".$_POST['guess'];
}
?>
<form method="post" action="<?php print $_SERVER['PHP_SELF']?>">
<p>
Type your guess here: <input type="text" name="guess" />
</p>
</form>
</div>
</body>
</html>

The code above generates the following result.

Create HTML Form That Calls Itself in PHP




















Home »
  PHP Tutorial »
    Form »




PHP Form
Form Demo