What number of the line is clicked

2

Ineedtopostthislinenumbertoanotherprogramphp

<divid="posiciona">
    <table id="mostra_prod" cellpadding="1" cellspacing="3" bordercolor="#000">
        <tr>
            <td align="right" bgcolor="#0a0a96">Aplicação</td>
            <td align="left"  bgcolor="#0a0a96">Referência</td> 
        </tr> 
        <?php 
        $i=0;         
        while ($row = mysqli_fetch_array($result_pd)) { 
            $rfprod  = $row['pro_referencia_produto'];
            $idref[] = $rfprod;  
            $i++;  
            $approd  = $row['pro_aplicacao_produto'];
            ?><tr><?php 
            echo "<td align='right' style='color: #cfcfd1;'>".$approd."</td>";
            echo "<td style='color: #ffffff;'>".$rfprod."</td>";
            ?></tr><?php 
       }
       ?>         
    </table>
</div>
    
asked by anonymous 09.08.2017 / 12:28

2 answers

0

Well, we have some things to do here:

09.08.2017 / 14:15
0

What you can do in a simple way is to insert a form field of radio into the table, along with a label , so when the table row is pressed, the field will be selected, containing the id of the record in question. For example, in the Aplicação column, put something like:

<td align='right' style='color: #cfcfd1;'>
  <label>
    Produto 1
    <input type="radio" name="aplicacao" value="1">
  </label>
</td>

When the line is pressed, the radio field will be selected containing the value 1. CAso does not want the field to be visible in the table, just hide it:

<input type="radio" name="aplicacao" value="1" style="display:none;">

See a working example:

body {
  background: gray;
}
<table id="mostra_prod" cellpadding="1" cellspacing="3" bordercolor="#000">
  <tr>
    <td align="right" bgcolor="#0a0a96">Aplicação</td>
    <td align="left"  bgcolor="#0a0a96">Referência</td> 
  </tr>
  <tr>
    <td align='right' style='color: #cfcfd1;'>
      <label>
        Produto 1
        <input type="radio" name="aplicacao" value="1">
      </label>
    </td>
    <td style='color: #ffffff;'>0001</td>
  </tr>
  <tr>
    <td align='right' style='color: #cfcfd1;'>
      <label>
        Produto 2
        <input type="radio" name="aplicacao" value="2">
      </label>
    </td>
    <td style='color: #ffffff;'>0002</td>
  </tr>
  <tr>
    <td align='right' style='color: #cfcfd1;'>
      <label>
        Produto 3
        <input type="radio" name="aplicacao" value="3">
      </label>
    </td>
    <td style='color: #ffffff;'>0003</td>
  </tr>
</table>

So, with the code being properly inside a form, the aplicacao field will be sent with the value of the selected line.

    
09.08.2017 / 14:01