[英]Different Values in Form Inputs
I have a simple HTML form that works with a PHP script (to process the values). 我有一个与PHP脚本一起使用的简单HTML表单(用于处理值)。
For some reason it's not working correctly. 由于某种原因,它无法正常工作。 After many tests, I inspect the mark-up for the form and I find:
经过多次测试,我检查了表格的标记,然后发现:
<form id="delete_item_3_form" action="upload/delete_item.php" method="post">
<input type="hidden" value="4" name="item_id">
<input type="hidden" value="test" name="item_info">
</form>
As it should be. 应该的。 Please note that the values for the inputs are hard-coded .
请注意,输入值是硬编码的 。
However, if I go to the browser console (I am using Chrome) and write: 但是,如果我转到浏览器控制台(我正在使用Chrome)并输入:
$('#delete_item_3_form');
I get: 我得到:
<form id="delete_item_3_form" action="upload/delete_item.php" method="post">
<input type="hidden" value="4" name="item_id">
<input type="hidden" value name="item_info">
</form>
As you can see the value from the second input, item_info, is empty. 如您所见,第二个输入item_info的值为空。 Both inputs have a name.
两个输入都有一个名称。
I am not new to Form Handling but I have never seen this. 我对表单处理并不陌生,但从未见过。 The page mark-up shows one thing in a form, and a simple jQuery call to the same form shows another thing.
页面标记在表单中显示了一件事,而对同一表单的简单jQuery调用则显示了另一件事。
I have nothing, on my scripts, changing the value of the inputs. 在脚本上,我什么都没有更改输入的值。
The form is submitted by the press of a button. 按下按钮即可提交表格。 Here is the jQuery code:
这是jQuery代码:
$('#delete_item').click(function()
{
$("#delete_item_3_form").submit();
});
How is this happening? 这是怎么回事?
页面中有另一个具有相同ID的表单。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.