Form Handling

  1. Processing form data.
<html>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
  Name: <input type="text" name="fname">
  <input type="submit">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
  $name = $_POST['fname'];
  echo "Hello, $name!";
}
?>
</body>
</html>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *