hey guys,
any tricks that i can use to link a table row with an employee ID that comes from a db ?
heres the menu code, where the link must happen, so i can call other functions like delete and modify.
sorry it's french, supprimer = delete, modifier = modify. The rest i dont think its important to translate.
function menu() {
$data = new dbFetch();
$data = explode("|", $data->tableau());
$chaine = "<table>
<tr>
<th>empID</th>
<th>Nom</th>
<th>Adresse</th>
<th>Salaire</th>
</tr>";
for($i=0; $i<count($data)-1; $i++){
$chaine .= "<tr>";
$data2 = explode(";", $data[$i]);
for($j=0; $j<count($data2)-1; $j++)
$chaine .= "<td>$data2[$j]</td>";
$chaine .= "<td>
<input type='hidden' name='empID' value='".$data2[0]."'>
<input type='submit' name='oper' value='Supprimer'>
<input type='submit' name='oper' value='Modifier'></td>
</tr>";
}//End for
$chaine .= "</table>";
$chaine .= "<input type='submit' name='oper' value='Inserer'/>";
return $chaine;
}//End menu
now ? does my $data2[0] really independant on each row ? because when i change the hidden to text on empID, i really get the value im supposed to get.
or the form consider the supprimer and modifier buttons like 1 for the all table ?
when i try to delete or modify something, it always pick the last entry on the db, which would be the last row in the table.
thx guys.
Dark