Similar to the following question (note the following question is related to symfony 2.3 - I don't know what that is, I'm just using HTML) :
How to disable html5-validation for specific buttons in symfony 2.3
Is it possible to bypass HTML5 validation (required
) for a specific button in HTML?
<form name="loginform" autocomplete="off" id="loginform" action="" method="post">
<nav class="clearfix">
<ul class="clearfix">
<li><input class="username" type="text" id="username" required placeholder="Username"></li>
<li><input class="password" type="password" id="password" required placeholder="Password"></li>
<li><button name="register" class="register">Register</button>
<button name="login" class="login">Log in</button></li>
</ul>
<a href="#" id="pull">Menu</a>
</nav>
</form>
I don't need validation if register button is clicked.
if(isset($_POST['register'])) {
header("Location: register.php");
}
Edit: A way of doing this without changing the structure of the form or changing the button :).