how disable submit button , submit form isset?
<script> function check() { codes validation. if(ok) { return true; } else { return false; } } </script> <form action="" method="post" onsubmit="return check()" > <input type="submit" class="btn btn-success" name="submit" value="submit"/> </form> <?php if(isset($_post['submit']) == "submit") { echo "test"; } ?> when disabled submit button, isset submit did not work.
i think mixed here, cannot submit form isset, php code runs when page loads , not after loads.
you can use jquery submit form if want way other submit button :
$("#formid").submit(); in script tag after loading jquery library.
the isset can check if submit button sent through post when form submitted, since have empty action, form submit same page exists within.
you shall make sure re-enable submit button if javascript validation fails in order allow user fix form input , submit again (this depends on code behavior practice).
Comments
Post a Comment