PHP -HTML -JavaScript从表单A形式B中复制值,并使用表格B作为DB的输入
这是我到目前为止所拥有的。
从表格A中获取值:
$('。table tbody').on('click','。btn',function(){
var currow = $(this).closest('tr');
var col1 = currow.find('td:eq(1)')。text();
var col2 = currow.find('td:eq(2)')。text();
var col3 = currow.find('td:eq(3)')。text();检查正确的值
警报(COL1+COL2+COL3+COL4);
将这些值设置为2
document.getElementById(“ i2”)。innerhtml = col1; document.getElementById('i2')。style.color =“ white”; document.getElementById(“ i3”)。innerhtml = col2; document.getElementById(“ i4”)。innerhtml = col3;
这一切都可以正常工作,我在表格中复制了值。该问题出现在表单B中,其中我有一个插入(DB)按钮,并且这并不是传递从表单A的所有值传递的所有值它们都以零值出现。
列不允许零。插入失败。 看来浏览器没有通过值。 关于如何解决此问题的任何暗示都将不胜感激!! 谢谢
This is what i have so far.
To get the values from form A:
$('.table tbody') .on('click','.btn',function(){
var currow = $(this).closest('tr');
var col1 = currow.find('td:eq(1)').text();
var col2 = currow.find('td:eq(2)').text();
var col3 = currow.find('td:eq(3)').text();Checking the correct values
alert(col1+col2+col3+col4);
setting these values to form 2
document.getElementById("I2").innerHTML= col1; document.getElementById('I2').style.color = "white"; document.getElementById("I3").innerHTML= col2; document.getElementById("I4").innerHTML= col3;
This all works fine, I have the values copied on Form B. The issue appears in Form B, where I have an insert (into DB) button and this is not passing all the values taken from form A, they all appear as NULL values.
column does not allow nulls. INSERT fails.
It seems the browser does not pass the values.
Any hint on how to solve this problem will be very appreciated!!
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用:
document.queryselector(“#i2输入”)。值= col1;
而不是:
document.getElementById(“ i2”)。innerhtml = col1;
解决了问题。
感谢您的投入
Using:
document.querySelector("#I2 input").value=col1;
Instead of:
document.getElementById("I2").innerHTML= col1;
Solved the Issue.
Thanks for your Input