I am confused that why the following code does not work. I just display a form, and after the user enters the name and clicks the "submit", I reload the page, but with $submit set, the code should print "got it".
But the following code just reload the form page w/o printing any thing.
Anyone could give some comment? thanks!
btw, if I use 'action="action.php" instead and put the "echo "got it" in that action.php page, it will work.
<html>
<body>
<?php
if ($submit) {
// process form
echo "got it\n";
} else{
// display form
?>
<form method="post" action="<?php echo $PHP_SELF?>">
First name:<input type="Text" name="first"><br>
<input type="Submit" name="submit" value="Enter information">
</form>
<?php
} // end if
?>
</body>
</html>