输出一个php多维数组到一个html表
问题描述
我有一个包含 8 列和可变行数的表单,我需要以格式良好的电子邮件将其通过电子邮件发送给客户.该表单将所需字段作为多维数组提交.粗略的例子如下:
I have a form that has 8 columns and a variable number of rows which I need to email to the client in a nicely formatted email. The form submits the needed fields as a multidimensional array. Rough example is below:
此表单以表格形式格式化,并且可以动态地向其中添加行.我一直无法做的是从数组中获取格式正确的表.
This form is formatted in a table, and rows can be added to it dynamically. What I've been unable to do is get a properly formatted table out of the array.
这就是我现在使用的(从网上抓取的).
This is what I'm using now (grabbed from the net).
这对于单行数据非常有效.如果我尝试从表单提交 2 行或更多行,则其中一列会消失.我希望表格的格式为:
This works perfectly for a single row of data. If I try submitting 2 or more rows from the form then one of the columns disappears. I'd like the table to be formatted as:
根据需要添加额外的行.但是,我找不到任何可以生成这种类型表的示例!
with additional rows as needed. But, I can't find any examples that will generate that type of table!
看起来这应该是相当简单的事情,但我只是找不到一个可以按照我需要的方式工作的示例.
It seems like this should be something fairly straightforward, but I just can't locate an example that works the way I need it too.
推荐答案
在您的 HTML 中,尝试如下操作:
In your HTML, try something like this:
显然,我没有把你的所有属性都包括在内,但希望你能明白.
Obviously, I'm not including all your attributes there, but hopefully you get the idea.
这篇关于输出一个php多维数组到一个html表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!