bonjour,
dans ton dernier lien tu fais réference à 3 ligne,peux tu me dire a quoielle correspondent?
si non j'ai commencé a restructurer mon code,avec une erreur sur cette ligne:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 $form_valid = 0; $form_msg_err = ''; $form_msg_OK = '';
Notice: Undefined index: num in C:\wamp\www\7-Applications\gestion.php on line 26
Code : Sélectionner tout - Visualiser dans une fenêtre à part $req=$pdo->query( "SELECT * FROM produit WHERE num ='".$_POST['num']."' " );
voici le code complet:
si non je n'arrive tjs pas à enclencher ma modif via une case cochée
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
77
78
79
80
81 <?php try{ $pdo = new PDO( 'mysql:host=localhost;dbname=messageries', 'root',''); } catch(exception $e) { die('erreur '.$e->getmessage()); } $pdo->exec("SET CHARACTER SET utf8"); ?> <?php if (isset($_POST['valide'])) { $num = ( !empty($_POST['num'])) ? $_POST['num'] : ''; $prix = ( !empty($_POST['prix'])) ? $_POST['prix'] : ''; $requete=("UPDATE produit SET prix=:prix WHERE num = :num "); $res=$pdo->prepare($requete); $res->execute(array( ':prix'=>$prix, ':num'=>$num )) ; } $req=$pdo->query( "SELECT * FROM produit WHERE num ='".$_POST['num']."' " ); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Messagerie au Support </title> </head> <body> <?php echo "<pre>"; print_r($req); echo "</pre>"; ?> <form id="monform" name="gestion" method="post" action="gestion.php"> <table width="400" border="1" cellspacing="1" cellpadding="8"> <?php while($affiche =$req->fetch()) {?> <form id="monform" name="form1" method="post" action="gestion.php"> <p> <table width="600 "border="1" cellspacing="0" cellpadding="2"> <tr> <td>Numéro : </td> <td><?php echo $affiche['num'] ; ?> </td> </tr> <tr> <td>Articles : </td> <td><?php echo $affiche['articles'] ; ?> </td> </tr> <tr> <td>Prix : </td> <td><?php echo $affiche['Prix'] ; ?> </td> </tr> <tr> <td>Modif Prix : </td> <td><textarea name="Modification" rows="1" cols="10"></textarea></td> <td><input type="checkbox" name="valide" value="modifier"/></td> </tr> </table> <?php }?> </table> <label> <input type="submit" name="bouton" value="Envoyer" /> </label> </form> </body> </html>
Partager