submitted by: Guest
PHP: form handling example - simple
This example shows a very simple form together with the form handling process on a single page.
code snippet:
<?php
//check if the submit variable exists
if ($_POST['Submit']) {
$mytext=$_POST['mytext'];
echo "<BR>got submission<BR>";
echo "<BR> you entered: $mytext<BR>";
//process form action
} else { //no form has been submitted, so display the form
?>
<form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>">
<input name="mytext" type="text" id="mytext">
<input type="submit" name="Submit" value="Submit">
</form>
<?php
}
?>



