代码之家  ›  专栏  ›  技术社区  ›  benhowdle89

在超链接中序列化要发送到PHP的数组

  •  1
  • benhowdle89  · 技术社区  · 15 年前

    我有这个:

    var postData = {};
                        $('#items tr').not(':first').each(function(index, value) {
                            var keyPrefix = 'data[' + index + ']';
                            postData[keyPrefix + '[index]'] = index;
                            postData[keyPrefix + '[supp_short_code]'] = $(this).closest('tr').find('.supp_short_code').text();
                            postData[keyPrefix + '[project_ref]'] = $(this).closest('tr').find('.project_ref').text();
                            postData[keyPrefix + '[om_part_no]'] = $(this).closest('tr').find('.om_part_no').text();
                            postData[keyPrefix + '[description]'] = $(this).closest('tr').find('.description').text();
                            postData[keyPrefix + '[quantity_input]'] = $(this).closest('tr').find('.quantity_input').val();
                            postData[keyPrefix + '[cost_of_items]'] = $(this).closest('tr').find('.cost_of_items').text();
                            postData[keyPrefix + '[cost_total_td]'] = $(this).closest('tr').find('.cost_total_td').text();
                        });
    

    我下一步要将它发送到PHP,我不想使用Ajax,因为我需要转到PHP页面并查看收到的结果。这个想法是从一个表中获取值,当用户按“预览”时,它将获取这些值并将它们带到一个PHP页面,我将设置一个发票样式的页面,用上面的值填充它。

    谢谢

    2 回复  |  直到 15 年前
        1
  •  1
  •   SW4    15 年前

        2
  •  1
  •   gillyb    15 年前

    method="post" $_POST['hiddenFieldName']

    Parameter Tampering

    推荐文章