PHP -HTML -JavaScript从表单A形式B中复制值,并使用表格B作为DB的输入

发布于 2025-01-22 19:23:01 字数 771 浏览 2 评论 0原文

这是我到目前为止所拥有的。

  1. 从表格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();

  2. 检查正确的值

    警报(COL1+COL2+COL3+COL4);

  3. 将这些值设置为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.

  1. 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();

  2. Checking the correct values

    alert(col1+col2+col3+col4);

  3. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔少女心 2025-01-29 19:23:01

使用:
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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文