bonjour,

j'aimerai pouvoir ajouter un commentaire à une ligne d'un tableau par l'intermediaire d'un bouton "radio" ainsi que d'un "submit". Voici des screens pour illustrer :

fichier nomenclature.php :


Donc il faut selectionner une ligne grace à un bouton radio (cercle rouge), puis appuyer sur l'icône en bas, on a alors l'ecran suivant :

fichier commentairepiece.php


Ici on a la ligne 1 du tableau de tout à l'heure. J'aimerai pouvoir écrire un commentaire, le valider, puis dès qu'on fait la même manip, on le retrouve de manière editable.

Voici mon code (commentairepiece.php):

Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
 
<?php
session_start();
?>
<script LANGUAGE="JavaScript">
var width = screen.width;
var height = screen.height;
window.resizeTo(width,height);
</script>
<?php
$serv=$_SESSION['service'];
include('../include/MySQL.php');
$cnx=connect();
 
if (isset($_POST['ajoutcommentairepiece']))
{
  $numdp=$_POST['numdp'];
  $avenant=$_POST['avenant'];
  $variante=$_POST['variante'];
  $hypothesechiffrage=$_POST['hypothesechiffrage'];
  $nom=$_POST['nom'];
  $ordre=$_POST['ordre'];
  $commentaire=$_POST['commentaire'];
  $query="update nomenclature set commentaire='$commentaire'
						where numdp='$numdp' and avenant='$avenant' and variante='$variante' 
						and hypothesechiffrage='$hypothesechiffrage' and nom='$nom' and ordre='$ordre'";
						$resultat=sendSQL($cnx,$query);   
  echo '<script language="javascript">';
  echo 'opener.focus();';
  echo 'self.window.close();';
  echo '</script>';
}
else
{
$numdp=$_GET['numdp'];
$avenant=$_GET['avenant'];
$variante=$_GET['variante'];
$hypothesechiffrage=$_GET['hypothesechiffrage'];
$nom=$_GET['nom'];
//$ordre=$_GET['ordre'];
 
 
$query="SELECT commentaire
        FROM nomenclature 
        where numdp='$numdp' and avenant='$avenant' and variante='$variante' 
        and hypothesechiffrage='$hypothesechiffrage' and nom='$nom'";
$res=sendSQL($cnx,$query);   
$commentairepiece=mysql_result($res,0,0);
$commentairepiece=stripslashes($commentairepiece);
echo '<Table width=100% height=100% border=0 cellpadding="0" cellspacing="0">';
echo '<td align="center" background="image/fond.jpg">';
echo "<br><font face='arial' size=4 color=#89abcd><center>Ajouter un commentaire<br></center></font>";
echo '<form action="commentairepiece.php" method="post">';
echo '<Table width=200 border=0	cellspacing=0 cellpadding=0 valign="top">';
echo '<tr align="left"><th>Num DP</th><th>Av</th>
<th>Var</th><th>Hyp</th><th>Nom de la pièce</th>';
echo '<tr><td width="6">';
echo '<input type="text" name="numdp" size="6" value="'.$numdp.'" readonly></td>';
echo '<td width="1">';
echo '<input type="text" name="avenant" size="1" value="'.$avenant.'" readonly></td>';
echo '<td width="1">';
echo '<input type="text" name="variante" size="1" value="'.$variante.'" readonly></td>';
echo '<td width="1">';
echo '<input type="text" name="hypothesechiffrage" size="1" value="'.$hypothesechiffrage.'" readonly></td>';
echo '<td width="1">';
echo '<input type="text" name="nom" size="22" value="'.$nom.'" readonly></td>';
echo '</table>';
echo '<br><br>';
echo '<Table width=100% border=0 cellpadding="0" cellspacing="0">';
echo '<tr><td align="center"><TEXTAREA NAME="commentairepiece" ROWS="6" COLS="65">'.$commentairepiece.'</TEXTAREA></td></tr>';
echo '<tr><td align="center"><br /><input type="submit" name="ajoutcommentairepiece" value="Ajouter le commentaire"></td></tr>';
echo '</form>';
}
 
mysql_close($cnx);
?>
Et voici comment j'appelle mon fichier dans nomenclature.php :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
echo '<a class="icone" href="#" onclick="javascript: window.open(\'commentairepiece.php?numdp='.$numdp.'&avenant='.$avenant.'&variante='.$variante.'&hypothesechiffrage='.$hypothesechiffrage.'&nom='.$nom.'&ordre='.$choix.'\',\'Com\',\'resizable=yes,scrollbars=yes,top=0,left=0,width=1024,height=768\');submit();return false;">
					<img src="image/pluscom.png" alt="Ajout commentaire" title="Ajout commentaire"/></a></td>';
Voilà, aujourd'hui je ne peux qu'écrire le commentaire, valider, mais il ne s'enregistre pas dans ma base donc n'apparait pas lors de la deuxième visite du boutou radio :/

Merci d'avances