selection d'une ligne d'un tableau HTML
Bonjour,
Alors je remplis un tableau HTML grâce à du PHP voir ci dessous , je voudrais pouvoir sélectionner une ligne, c'est à dire récupérer la première colonne qui correspond à l'id et mettre la valeur de l'id dans un input.
Donc déjà es ce possible ? Si oui en PHP ? En JavaScript ? Autre ?
merci et désolée si je poste pas au bonne endrois je suis nouvelle !:oops:
voila mon code :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| <div id="c_tableau">
<div style="margin-left:40px"><table id="ct_tab" class="defaut_tab">
<div style="margin-left:40px"><tr id="ctt_tr" class="defaut">
<div style="margin-left:40px"><th id="ctt_th1" class="defaut">Id</th>
<th id="ctt_th2" class="defaut">n26E</th>
<th id="ctt_th3" class="defaut">nSerie</th>
<th id="ctt_th4" class="defaut">hostname</th>
<th id="ctt_th5" class="defaut">nom complet</th>
<th id="ctt_th6" class="defaut">nature</th>
<th id="ctt_th7" class="defaut">affectation</th>
<th id="ctt_th8" class="defaut">utilisation</th>
<th id="ctt_th9" class="defaut">site</th>
<th id="ctt_th10" class="defaut">date de</br> livraison</th>
<th id="ctt_th11" class="defaut">date de fin de</br> garantie</th>
<th id="ctt_th12" class="defaut">date de fin de</br> maintenance</th>
<th id="ctt_th13" class="defaut">comentaire</th></div></tr>
<?php
<div style="margin-left:40px">$nb = count($list);
$nb--;
if ($nb == 0){
<div style="margin-left:40px">echo ("<tr><td> Pas de résultats ! </td></tr>\n");</div>}
else{
<div style="margin-left:40px">for($i=0;$i<$nb;$i++){
<div style="margin-left:40px">$id = $list[$i]['IdEquip'];
$n26E = $list[$i]['n26E'];
$nSerie = $list[$i]['nSerie'];
$hostname = $list[$i]['hostname'];
$nomComplet = $list[$i]['nomComplet'];
$nature = $list[$i]['nature'];
$affect = $list[$i]['affectation'];
$util = $list[$i]['utilisation'];
$site = $list[$i]['site'];
$dateLivr = $list[$i]['dateLivraison'];
$dateFmaint = $list[$i]['dateFmaint'];
$dateFgar = $list[$i]['dateFgarantie'];
$comm = $list[$i]['commentaire'];
echo ("<tr class=\"defaut\">
<div style="margin-left:40px"><td class=\"c1\">$id</td>
<td class=\"c2\">$n26E</td>
<td class=\"c1\">$nSerie</td>
<td class=\"c2\">$hostname</td>
<td class=\"c1\">$nomComplet</td>
<td class=\"c2\">$nature</td>
<td class=\"c1\">$affect</td>
<td class=\"c2\">$util</td>
<td class=\"c1\">$site</td>
<td class=\"c2\">$dateLivr</td>
<td class=\"c1\">$dateFmaint</td>
<td class=\"c2\">$dateFgar</td>
<td class=\"c1\">$comm</td></div></tr>\n");</div>}</div>}</div>?></div></table></div></div> |