I am trying to make the link inside the form go to signup2.php. Instead it is going to loginprocess.php. Is there any way to do this by keeping the signup link inside the form?
<form action = "loginprocess.php" method = "post" enctype="multipart/form-data"> <h1>Login</h1> <p> Username:<input type = "text" name = "username"></p> </br> <p> Password:<input type = "password" name = "password"></p> </br> <input class = "submit" type = "submit" name = "submit" value = "Login"> <a href = "signup2.php"><button>Don't have an account? Sign Up</button></a> </form>
Buttons inside forms are automatically treated as submit buttons as is apparent in this post. If you want to alter this functionality, there are a few options.
<button type="button">Don't have an account? Sign Up</button>
<form action="loginprocess.php" method="post" enctype="multipart/form-data" onsubmit="return false;"></form>
const submit_button = document.querySelector('.submit'); const form = document.querySelectors('form') submit_button.addEventListener('click', () => form.submit())