Create a simple HTML form and accept the user name and display the name through PHP echo statement.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Post Data</title>
</head>
<body>
<form method="POST" action="">
<label>Enter First Name</label>
<input type="text" name="firstname" id="firstname" />
<input type="submit" name="submit_button" value="Submit Name" />
</form>
</body>
</html>
<?php
if(isset($_POST) && !empty($_POST))
{
echo "<h3> Hello ".$_POST['firstname']."</h3>";
}
?>
Comments
Post a Comment