php
  • html
  • arrays
  • post
  • 2011-07-31 23 views 0 likes 
    0

    有這個html頁面,我在某些字段中輸入並在php中發佈所有值。這裏是我的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

    我也試過那一個,但我不知道如何調用我的'planklist'數組,並把它放在一個網格中。 – jayAnn

    +0

    你檢查了jqgrid的API文檔嗎? [http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options] – Nick

    相關問題