Result Size: 625 x 571
x
 
<!DOCTYPE html>
<html>
<body>
<form method="post" action="https://www.w3schools.com/php/<?php%20echo%20$_SERVER['PHP_SELF'];?>">
  Name: <input type="text" name="fname">
  <input type="submit">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    // collect value of input field
    $name = $_POST['fname']; 
    if (empty($name)) {
        echo "Name is empty";
    } else {
        echo $name;
    }
}
?>
</body>
<!-- Mirrored from www.w3schools.com/php/phptryit.asp?filename=tryphp_global_post by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:29:32 GMT -->
</html>
×

Report a Problem: