sql >> Databáze >  >> RDS >> Mysql

Zachycení hodnot prvků HTML v dynamické tabulce

Opravte mě Pokud se nemýlím.. Zde chcete získat celou hodnotu z formuláře Správně? po kliknutí na tlačítko odeslat?Proč děláte toto tlačítko href?Předpokládejme, že v mém $resultu máme 3 data a smyčky vypadají níže

 <form method="post" action="">
<tr>
       <td scope="row"></td>
       <input type ="text" name="sourece" value=1 />
              <td>                         
                    <input type="number" class="form-control" id="shift1PinCount" name="shift1PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 1" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift1Oa" name="shift1Oa" value="1" disabled>
              </td>

              <td>
                    <input type="number" class="form-control" id="shift2PinCount" name="shift2PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 2" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift2Oa" name="shift2Oa" value="2" disabled>
              </td>

              <td>
                    <input type="number" class="form-control" id="shift3PinCount" name="shift3PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 3" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift3Oa" name="shift3Oa" value="3" disabled>
              </td>

              <td>
                    <input type="number" class="form-control" id="shift4PinCount" name="shift4PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 4" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift4Oa" name="shift4Oa" value="4" disabled>
              </td>

              <td><input class="form-control" type="date" id="shiftDate" name="shiftDate" value="<?=date("Y-m-d")?>"></td>

              <td>
                <input type="submit" class="btn btn-primary" name="savePcData" id="savePcData" value="savePcData">
              </td> 
</form>
</tr>
<form method="post" action="">
<tr>
       <td scope="row"></td>
       <input type ="text" name="sourece" value=2 />
              <td>                         
                    <input type="number" class="form-control" id="shift1PinCount" name="shift1PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 1" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift1Oa" name="shift1Oa" value="11" disabled>
              </td>

              <td>
                    <input type="number" class="form-control" id="shift2PinCount" name="shift2PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 2" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift2Oa" name="shift2Oa" value="22" disabled>
              </td>

              <td>
                    <input type="number" class="form-control" id="shift3PinCount" name="shift3PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 3" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift3Oa" name="shift3Oa" value="33" disabled>
              </td>

              <td>
                    <input type="number" class="form-control" id="shift4PinCount" name="shift4PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 4" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift4Oa" name="shift4Oa" value="44" disabled>
              </td>

              <td><input class="form-control" type="date" id="shiftDate" name="shiftDate" value="<?=date("Y-m-d")?>"></td>

              <td>
                <input type="submit" class="btn btn-primary" name="savePcData" id="savePcData" value="savePcData">
              </td> 
</form>
</tr>
<form method="post" action="">
<tr>
       <td scope="row"></td>
       <input type ="text" name="sourece" value=3 />
              <td>                         
                    <input type="number" class="form-control" id="shift1PinCount" name="shift1PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 1" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift1Oa" name="shift1Oa" value="111" disabled>
              </td>

              <td>
                    <input type="number" class="form-control" id="shift2PinCount" name="shift2PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 2" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift2Oa" name="shift2Oa" value="222" disabled>
              </td>

              <td>
                    <input type="number" class="form-control" id="shift3PinCount" name="shift3PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 3" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift3Oa" name="shift3Oa" value="333" disabled>
              </td>

              <td>
                    <input type="number" class="form-control" id="shift4PinCount" name="shift4PinCount" placeholder="Pin Count" title="Please key in Pin Count for Shift 4" min=0>
              </td>

              <td>
                    <input type="text" class="form-control" id="shift4Oa" name="shift4Oa" value="444" disabled>
              </td>

              <td><input class="form-control" type="date" id="shiftDate" name="shiftDate" value="<?=date("Y-m-d")?>"></td>

              <td>
                <input type="submit" class="btn btn-primary" name="savePcData" id="savePcData" value="savePcData">
              </td> 
</form>
</tr>

<?php

if(isset($_POST['savePcData'])){

    echo "<pre>";
    print_r($_POST);
    die('mms');

}


?> 

Váš výstupní vklad bude

zde zdroj je vaše jedinečné ID, které vám pomáhá aktualizovat data do vaší DB

Po odeslání formuláře z libovolného tr(row) budete přesměrováni na stejnou stránku pomocí metody POST a získáte data pro tento konkrétní řádek na této stránce, abyste jej mohli snadno aktualizovat, jak chcete

Můžete to zkontrolovat pomocí print_r($_POST); na stejné stránce

Pokud máte nějaké dotazy, neváhejte se mě zeptat...




  1. Přidejte spoustu dat s určitým časovým intervalem v Javě

  2. MySQL koncepty:relace vs připojení

  3. Vypočítat věk v MySQL (InnoDb)

  4. Jak z databáze dostat DateTime s možnou hodnotou Null