Submit Form to itself in PHP

Description

The following code shows how to submit Form to itself.

Example


/*from w  ww. j ava 2 s . co  m*/
<?php
    if (isset($_POST['submit'])){
        echo "Hi ".$_POST['name']."!<br />";
        echo "The address ".$_POST['email']." will soon be a spam-magnet!<br />";
    }
?>

<form action="index.php" method="post">
Name:<input type="text" name="name" size="20" maxlength="40" value="" />
Email Address:
<input type="text" name="email" size="20" maxlength="40" value="" />
<input type="submit" name = "submit" value="Go!" />
</form>

The code above generates the following result.

Submit Form to itself in PHP




















Home »
  PHP Tutorial »
    Form »




PHP Form
Form Demo