Redirecting to a page after submitting form in HTML

For anyone else having the same problem, I figured it out myself.

    <html>
      <body>
        <form target="_blank" action="https://website.com/action.php" method="POST">
          <input type="hidden" name="fullname" value="Sam" />
          <input type="hidden" name="city" value="Dubai&#32;" />
          <input onclick="window.location.href="https://website.com/my-account";" type="submit" value="Submit request" />
        </form>
      </body>
    </html>

All I had to do was add the target=”_blank” attribute to inline on form to open the response in a new page and redirect the other page using onclick on the submit button.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)