this is my shash.html page
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
<form action="shash.php" method="post">
Name:<input type="text" name="username" id="username">
<span class="error">*<?php echo "$nameError" ; ?></span>
Password:<input type="password" name="password" id="password"><br>
Email:<input type="text" name="email" id="email"><br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
this is my shash.php page
<?php
$nameError="";
$name="";
if(isset($_POST['submit'])){
if (empty($_POST["username"])) {
$nameError = "Name is required";
} else {
$username=$_POST['username'];
echo $username;
}
}
?>
in .html page if i not fill in the Name area nd cilck submit button, it is not showing any error message like
Name is required
,it is simply redirected to .php page.i want to dispay error message in .html page itself
i wrote .php and .html code in the separate pages ,is it possible to display the $nameError in .html page??