发布和获取方法未显示正确的 URL


Post and get method not show correct url

<form action="../index.php?option=com_rsform&formId=3" method = "get">
  <input type="hidden" name='form[Name]' value="1">
  <input type="submit" value="Submit">
</form>

我需要这个结果:

http://localhost/index.php?option=com_rsform&formId=3&form[Name]=1

但我得到这个结果:

http://localhost/index.php?form%5BName%5D=1

问题出在哪里?

当存在action URL 参数和表单字段的组合时,这似乎是有关表单操作的预期行为,目前我在规范中没有找到任何说明其他情况的行为。

实际的解决方案似乎是将您想要的值放在表单本身中:

<form action="../index.php" method="get">
  <input type="hidden" name='option' value="com_rsform">
  <input type="hidden" name='formId' value="3">
  <input type="hidden" name='form[Name]' value="1">
  <input type="submit" value="Submit">
</form>

检查这个:提交带有查询字符串参数和隐藏参数的 GET 表单消失

"action"的GET参数被表单覆盖。所以,大卫的回答是正确的。

其他解决方案:制作POST表单并保持URL;)