Which way to use to update table in PHP / MySQL / HTML?

0

Good afternoon!

There is a form that when completed should be done UPDATE in a table in MySQL. Below is the form and just below the table with the checkbox's that will signal which line should be updated. How do I implement this knowing that each checkbox is created for each line that exists for SELECT and while reported?

<form id="alteracoes" name="alteracoes" method="post" action="AlteraStatus.php" onsubmit="return true;">
  <table width="50%" border="0">
    <tr>
      <th colspan="5" align="center" valign="top">
        <h2>Alteracoes</h2>
      </th>
    </tr>
    <tr>
      <td width="50">Viagem:</td>
      <td width="835"><input name="VIAGEM" type="text" id="VIAGEM" size="20" maxlength="14" value="" /></td>
    </tr>
    <tr>
      <td width="165">Novo STATUS:</td>
      <td>
        <select name="status" id="status">
          <option value="0">Recebido</option>
          <option value="1">Em trânsito</option>
          <option value="2">Encerrado</option>
        </select>
      </td>

    </tr>
    <tr>
      <td width="50">Embarcação:</td>
      <td width="835"><input name="EMBARC" type="text" id="EMBARC" size="20" maxlength="10" value="" /></td>
    </tr>
    <tr>
      <td width="50">Data Saída:</td>
      <td width="835"><input name="DATSAI" type="text" id="DATSAI" size="20" maxlength="10" value="" /><span class="style1"> Formato DDMMAAA</span></td>
    </tr>
    <tr>
      <td width="50">Hora Saída:</td>
      <td width="835"><input name="HORSAI" type="text" id="HORSAI" size="20" maxlength="10" value="" /><span class="style1"> Formato HHMM</span></td>
    </tr>
    <tr>
      <td width="50">Data Chegada:</td>
      <td width="835"><input name="DATCHE" type="text" id="DATCHE" size="20" maxlength="10" value="" /><span class="style1"> Formato DDMMAAA</span></td>
    </tr>
    <tr>
      <td width="50">Hora Chegada:</td>
      <td width="835"><input name="HORCHE" type="text" id="HORCHE" size="20" maxlength="10" value="" /><span class="style1"> Formato HHMM</span></td>
    </tr>
    <tr>
      <td width="50">Origem:</td>
      <td width="835"><input name="ORIG" type="text" id="ORIG" size="20" maxlength="10" value="" /></td>
    </tr>
    <tr>
      <td width="50">Destino:</td>
      <td width="835"><input name="DEST" type="text" id="DEST" size="20" maxlength="10" value="" /></td>
    </tr>
    <tr>
      <td colspan="2">
        <p>
          <input name="atualizar" type="submit" id="atualizar" value="Atualizar" />
          <br />
        </p>
      </td>
    </tr>
  </table>
</form>

Related table that lists the values of SELECT :

while($aux = mysqli_fetch_assoc($sql_dtc)) { 
        echo '<tr>';
        $contador=$contador+1;
        echo '<td><input type="checkbox" name="vetor[]" id="" value=""></td>';
        echo $contador;
        echo '<td>'.$aux["DTC_CGCPAG"].'</td>';
        echo '<td>'.$aux["DTC_DATREC"].'</td>';
        echo '<td>'.$aux["DTC_CGCFOR"].'</td>';
        echo '<td>'.$aux["DTC_TIPDOC"].'</td>';
        echo '<td>'.$aux["DTC_NUMNFC"].'</td>';
        echo '<td>'.$aux["DTC_FORNEC"].'</td>';
        echo '<td>'.$aux["DTC_QTDVOL"].'</td>';
        echo '<td>'.$aux["DTC_PROCES"].'</td>';
        if ($aux["DTC_STATUS"]==0){
            echo '<td>'.'Recebido'.'</td>';
        }
        elseif ($aux["DTC_STATUS"]==1){
            echo '<td>'.'Em trânsito'.'</td>';
        }
        else{
            echo '<td>'.'Encerrado'.'</td>';
        }
        echo '<td>'.$aux["DTC_CDRORI"].'</td>';
        echo '<td>'.$aux["DTC_NUMVGA"].'</td>';
        echo '<td>'.$aux["DTC_CDRDES"].'</td>';
        echo '<td>'.$aux["DTC_CODVEI"].'</td>';
        echo '<td>'.$aux["DTC_DATSAI"].'</td>';
        echo '<td>'.$aux["DTC_HORSAI"].'</td>';
        echo '<td>'.$aux["DTC_DATCHE"].'</td>';
        echo '<td>'.$aux["DTC_HORCHE"].'</td>';
        echo '</tr>';
    
asked by anonymous 24.07.2018 / 22:29

0 answers