Skip to content

Instantly share code, notes, and snippets.

@Pavaniysk
Created January 4, 2023 17:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pavaniysk/4f1b0786e8c7e43331416f17fafd975d to your computer and use it in GitHub Desktop.
Save Pavaniysk/4f1b0786e8c7e43331416f17fafd975d to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<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") {
// collect value of input field
$name = $_POST['fname'];
if (empty($name)) {
echo "Name is empty";
} else {
echo $name;
}
}
?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment