This code alone is not sufficient to achieve what you're aiming for. You'll need to implement and adjust a few things here:
Change the button to a submit button: This way, the form's built-in validation will check all fields before submission.
Add JavaScript validation: Here, you can run validations and handle redirection according to your logic.
There are many resources available on JavaScript validation. Good luck!"