HTML form send data by GET instead POST

2019-07-10 05:03发布

It is very strangely, but my HTML form send data via GET, not POST.

    <form name="mistake" action="http://web-server.com:8888/WebApp/Email/Create" method=post>
  <input type="text" name="url" size="50" readonly="readonly">
          <br />
          <span class="text">
          Error :
          </span>
          <br /> 
          <textarea rows="5" name="mis" cols="37" readonly="readonly"></textarea> 
          <br />
          <span class="text">
          Comment :
          </span>
          <br /> 
          <textarea rows="5" name="comment" cols="37"></textarea> 

          <input type="hidden" name="email" value="admin@admin.com">
          <input type="hidden" name="subject" value="Errors">
          <div style="margin-top: 7px"><input type="submit" value="Submit">
          <input onclick="hide()" type="button" value="Close" id="close" name="close"> 
          </div>
</form> 

I test it on IE10 with standart options.
HTML form very simple and i write only little example of code.
How to fix it?
Thank you!

P.S. Change URL. This URL web-server.com:8888/WebApp/Email/Create - belongs to asp mvc app.

When i run my web app and ths static site on local machine- it works. But when i runs static page on local machine- and mvc on server- it not works.

P.P.S.- this variant of form- is origine (i cut some tags). Now it is origine.

I dont why, but it works. May be - problem on server side?

标签: html post get
6条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-07-10 05:09

A web application framework I am using automatically redirects POST requests for the action URL to the same URL with a trailing slash. HTTP redirection downgrades POST to GET.

查看更多
Evening l夕情丶
3楼-- · 2019-07-10 05:19

Try method="post" instead of method=post

查看更多
smile是对你的礼貌
4楼-- · 2019-07-10 05:21

The problem is rather common and the answer quite elusive:

Somewhere in your code you have an orphaned <form>. This means that the next form is nested in the previous one, and its method is ignored. Delete or close the superfluous <form> and you are done.

查看更多
欢心
5楼-- · 2019-07-10 05:22

It should be a post (assuming that you forgot the closing tag only in your example). I added your code and put the closing tag in an html file and submitted in Chrome. This is what I see in the network trace:

enter image description here

Also look at this question in case you are doing the same.

查看更多
兄弟一词,经得起流年.
6楼-- · 2019-07-10 05:29

I did have the same problem once here what i did: the problem first come when a form is nested inside another one, and its method is ignored.

the solution is pretty simple: Delete or close the superfluous and you're good to go .

查看更多
一夜七次
7楼-- · 2019-07-10 05:35

May simply be that your user-agent is ignoring the form method because you haven't put quotes around the attribute.

Try:

 <form name="mistake" action="http://web-server:8888/WebApp/Email/Create" method="post">
查看更多
登录 后发表回答