vendredi 22 octobre 2021

Using if(isset($_POST['submit'])) to display message but it is not working

I tried to write simple Form validation with PHP. When click submit button if the name is empty then the website will ask the user to fill in. But when i click the submit button nothing appear on the screen. Can you help me how to fix this problem? Thank you. Here is my code :

<?php
if (isset($_POST["submit"])){
    if(!empty($_POST["Ename"])){

    }else{
        echo"Please enter your name";
    }
}
?>
<html>
<form class="" action="index.php" method="post">
Tutor name: <input type="text" name="Ename" value="">
<input type="button" class="submit" value="Submit your record" name="submit">
</form>
</html>



Aucun commentaire:

Enregistrer un commentaire