Sina Jahanbakhsh Sina Jahanbakhsh - 4 months ago 10
PHP Question

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>


and i need this result:

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


but i get this result:

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


where is the problem?

Answer

This seems to be expected behavior regarding form actions when a combination of action URL parameters and form fields are present, and at the moment I'm not finding anything in a spec which tells otherwise.

The practical solution seems to be to just put the values you want in the form itself:

<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>