<form id="frmAddCat" name="frmAddCat" method="post" action="<?php echo $PHP_SELF; ?>"> Enter Catagory Name: <input name="catName" type="text" id="catName" /> <input type="submit" name="Submit" value="Add" /> </form> <?php if( $_POST['Submit']) { echo ("Submit button click"); } ?> I am using this code but this code has a big bug. When the page is open the "if" block execute only with the mouse click on submit button. If user filled out the catagory name and press enter then the "if" block cannot execute. How can i solve this.
Instead of using if( $_POST['Submit']) try to use this if( $_POST['catName']) or if( !empty($_POST['catName'])) and it should work.