开发者

Form action doesn't submit hard-coded variable

I have a form with the code below, which sends form option choice as "project" variable.

<form name="proj开发者_运维技巧ects" method="get" action="\web\ttt.php?str=aaa" >

However, the output always looks this:

/ttt.php?Projects=3 //there is str=aaa missing which I defined in the form action.

How to let it pass this variable?

Thanks


When using GET as method all query params in the action attribute are discarded and the items in the form are used instead, either change to POST instead of GET or add a hidden field with the name 'str' and value 'aaa' to achieve what your are trying to do.


You should use an hidden input control to pass variables with a form.

<input type="hidden" name="myname" value="myvalue" />


<form name="projects" method="get" action="\web\ttt.php">
    <input type="hidden" name="str" value="aaa" />
    // Other form stuff
</form>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜