2011-07-31 5 views
0

私はいくつかのフィールドに入力し、PHPですべての値を投稿するこのhtmlページがあります。ここに私のhtmlコードです:私は新しい板を追加テーブルからPHPで配列をポスト

 <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
<table id="plankList" name="plankList[]"></table> 

私は..

HTMLのマークアップが正しい上記のかはわからないそして、あなたはこの

[{"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"}] 

のような配列またはJSON形式を持っている場合は、Ajaxのリクエストでこれを投稿することができます(jquery)。

+0

私もその1つを試みましたが、私の 'planklist'配列を呼び出してグリッドに入れる方法はわかりません。 – jayAnn

+0

jqgridのAPIドキュメントをチェックしましたか? [http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options] – Nick