I am creating a simple form with HTML and PHP.I put this code in index.html:
<form action="formdata.php" method="post">
<h3 class="h3">First Name:</h3>
<input type="text" name="fname"></input>
<h3 class="h3">Last Name:</h3>
<input type="text" name="lname"></input>
<br>
Male
<input type="radio" name="sex" value="Male"></input>
Female
<input type="radio" name="sex" value="Female"></input><br>
<input type="Submit" value="submit"></input><br>
</form>
And here is my PHP code:
<html>
<head>
<title>PHP script</title>
</head>
<body>
First Name: <?php echo $_POST["fname"]; ?><br>
Last Name: <?php echo $_POST["lname"]; ?>
</body>
</html>
But the output in php is not showing names.It just showing
First Name:
Last Name:
What should i do?