Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
html表单未在回发时发布输入控件值_Html_Forms_Post - Fatal编程技术网

html表单未在回发时发布输入控件值

html表单未在回发时发布输入控件值,html,forms,post,Html,Forms,Post,我有一个非常简单的html页面,其中只有一个表单和几个控件。此html页面位于服务器上。当我在输入字段中使用一些值发布此表单时,它不会在表单发布数据中显示输入值 reuest body仅包含btn1=此处未列出其他控件 以下是html: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <

我有一个非常简单的html页面,其中只有一个表单和几个控件。此html页面位于服务器上。当我在输入字段中使用一些值发布此表单时,它不会在表单发布数据中显示输入值

reuest body仅包含btn1=此处未列出其他控件

以下是html:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>test</title>
</head>
<body>    
    <form id="form4" action="somePage.htm" method="post" >
    <input type="text" id="textMain1" value="" />
    <input type="text" id="textMain2" value=""/>
    <input type="text" id="textMain3" value=""/>

    <input type="submit" id="btn1" name="btn1"  />
    </form>
</body>
</html>![enter image description here][2]

测试
![在此处输入图像描述][2]
这些东西我已经试过了: -将name和id属性一起添加到输入控件 -在case中添加runat=server(html页面是用VS IDE编写的) -将enctype=“多部分/表单数据”添加到表单 -在chrome浏览器中运行它

这可能是您想要的和对您有用的定义

$("#form4").submit(function(event) {

/* stop form from submitting normally */
event.preventDefault();

/* get some values from elements on the page: */
 var values = $(this).serialize();

/* Send the data using post and put the results in a div */
$.ajax({
  url: "test.php",
  type: "post",
  data: values,
  success: function(){

  },

  }); 
});

但是一个简单的IISreset解决了这个问题。无法使用Jquery,因为客户端浏览器不支持它。在控件中始终具有name属性,您希望该属性出现在post数据中。姓名1:2姓名2:5姓名3:6 btn1:post