有这个html页面,我在某些字段中输入并在php中发布所有值。这是我的HTML代码:
<form action = 'preViewTallyHdr.php' method = 'POST' target="_blank">
<p>Supplier Name & contact person:
<input class = 'supplier' type = 'text' id = 'supplierInput' value = '' STYLE="color: blue"; size="47" name = "supplier">
</p>
<p>Wood specie description:
<input class = 'woodSpe' type = 'text' id = 'woodSpecie' value = ''STYLE="color: blue"; size = "55" name = "wood">
</p>
<!--this is for viewing newly added planks (jqgrid)-->
<table id="plankList" name="plankList[]"></table>
<div id="pgrid"></div>
<!--this button will open another dialog (dialogAdd) for adding new plank-->
<input type ='button' id="btnAddnew" value = 'Add Plank'>
<input type = "Submit" value="Preview">
</form>
<div id="dialogAdd" title="Plank Entry">
<form method="post" action="#" id="plank_form">
<p>Plank number :
<input type="text" class="integer" name="plank_number" id="plank_number"/></p>
<p>Thickness:
<input type="text" class="numeric" name="thickness" id="thickness"/></p>
<p>Width:
<input type="text" class="numeric" name="width" id="width"/></p>
<p>Length:
<input type="text" class="numeric" name="length_t" id="length_t"/></p>
<p>Quantity:
<input type="text" class="integer" name="quantity" id="quantity"/></p>
</form>
</div>
Evrytime我添加了一个新的木板,我在我的jqgrid中创建了一个像这个ti显示的数组:
[{"plank_number":"1","thickness":"5","width":"7","length_t":"8","quantity":"1"},
{"plank_number":"2","thickness":"5","width":"6","length_t":"7","quantity":"1"},
{"plank_number":"3","thickness":"6","width":"7","length_t":"8","quantity":"1"}]
并将继续,具体取决于用户输入的纸板数量。
我已经有一个.php文件可以输出我的供应商和木材种类,但我不知道如何在那里显示我的帖子表数据。下面是我在php中的代码(没有用于显示表格的代码)。
<p>Supplier Name & contact person:<?php echo $_POST['supplier'];?><br/>
</p>
<p>Wood specie description:<?php echo $_POST['wood'];?>
</p>
<?php
//this is for my table which i don't know how to start
?>
而且,我还能从我的数据中制作一张表吗?
答案 0 :(得分:0)
<table id="plankList" name="plankList[]"></table>
我不确定上面的html标记是否正确..
如果您有像这样的数组或json格式
[{"plank_number":"1","thickness":"5","width":"7","length_t":"8","quantity":"1"},
{"plank_number":"2","thickness":"5","width":"6","length_t":"7","quantity":"1"},
{"plank_number":"3","thickness":"6","width":"7","length_t":"8","quantity":"1"}]
您可以在ajax请求(jquery)中发布此内容。