How to demonstrate the use of $_POST superglobal variable in PHP | PHP program
We will demonstrate the use of the $_POST superglobal variable by creating a submit button using the post method with the help of a form tag.
<html>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
Enter country name: <input type="text" name="country">
<input type="submit">
</form>
<?php
//PHP program to demonstrate the use
//of $_POST superglobal variable.
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$country = $_POST['country'];
printf("Country Name: %s<br>", $country);
}
?>
</body>
</html>


