Skip to content

Instantly share code, notes, and snippets.

@Pavaniysk
Created January 4, 2023 17:20
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/c089290f16de345c55672747bb1c2266 to your computer and use it in GitHub Desktop.
Save Pavaniysk/c089290f16de345c55672747bb1c2266 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">
<br>
<br>
father name:<input type="text" name="fname">
<br>
<br>
mother name:<input type="text" name="fname">
<br>
<br>
mobile number:<input type="number" name="user">
<br>
<br>
<input type="submit">
</form>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// collect value of input field
$name = htmlspecialchars($_REQUEST['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