Php form handling

This post is used to handle the html form and display the current function calling $_php_self .

php form handling


Code:

<?php
  if( $_POST["name"] || $_POST["age"] )
  {
     echo "Welcome ". $_POST['name']. "<br />";
     echo "Your age is ". $_POST['age']. " years old.";
     
  }
?>
<html>
<body>
  <form action="<?php $_PHP_SELF ?>" method="POST">
  Name: <input type="text" name="name" />
  Age: <input type="text" name="age" />
  <input type="submit" />
  </form>
</body>
</html>

Post a Comment

0 Comments