HTML Form: why action can't have get value in it?

前端 未结 7 2249
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-19 12:07

When i try the following structure, it does\'t send id=value

7条回答
  •  春和景丽
    2020-12-19 12:27

    What are you trying to do? What is the purpose of doing it this way? If you set the method of your form to "GET" and then have the hidden field in your form with a name of "id" it will append the get variables to the end of the action and create a url for you.

    Update: if the browser allowed querystring params to remain while appending params from a from GET, then there could be a collision between names. You could easily add another querystring paramater to a URL without realizing it collides with a form input name.

    To avoid this, if you are using GET action in your forms, pass all additional params as hidden inputs.

提交回复
热议问题