IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

formulaire de MAJ, donnée ne se modifie pas, pas de messages d'erreur! [PHP 5.4]


Sujet :

Langage PHP

  1. #1
    Membre régulier
    Femme Profil pro
    Webdesigner
    Inscrit en
    Juin 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 38
    Localisation : Belgique

    Informations professionnelles :
    Activité : Webdesigner

    Informations forums :
    Inscription : Juin 2014
    Messages : 176
    Points : 74
    Points
    74
    Par défaut formulaire de MAJ, donnée ne se modifie pas, pas de messages d'erreur!
    bonjour,
    j'ai un formulaire de départ:
    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
    include '/bdd_jung.php';
    include "/Validation/vendor/autoload.php";
     
    use Respect\Validation\Validator as v;
     
    $sql=$bdd->prepare('SELECT offre_de_prix.offreNumero,offre_de_prix.offreDate, offre_de_prix.offreFinDate, clients.clientNom,clients.clientRemise,produits.produitRef,produits.produitPu,produits.produitDescription,categorie.categorieNom,projet.projetNom,commentaires.commentaireNom,offre_de_prix.offreQuantite,offre_de_prix.offreTotal,clients.clientNumero FROM offre_de_prix, clients, produits, categorie, projet, commentaires WHERE offre_de_prix.clientID=clients.clientID AND projet.clientID=clients.clientID AND produits.categorieId=categorie.categorieId ORDER BY offreNumero DESC LIMIT 1');
    $reslt=$sql->execute();
    $row = $sql->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT);
     
    echo '<div class="form_inscription">';
    echo'<h3>formulaire d\'offres de prix, inscription :</h3>';
    echo'<form action="" method="post">';
    echo'<label>numéro de l\'offre:</label>';
    echo"<input type='text' name='offreNumero' value='$row[0]'>";
    echo'<br>';
    echo'<label>date de l\'offre :</label>';
    echo"<input type='date' name='offreDate' value='$row[1]'>";
    echo'<br>';
    echo'<label>fin de l\'offre : </label>';
    echo"<input type='date' name='offreFinDate' value='$row[2]'>";
    echo'<br>';
    echo'<label for="clientNom">nom du client:</label>';
    echo"<input id='clientNom' type='text' name='clientNom' value='$row[3]'>";
    echo'<br>';
    echo'<label>numero du client:</label>';
    echo"<input type='text' name='clientNumero' value='$row[13]'>";
    echo'<br>';
    echo'<label>Projet :</label>';
    echo"<input type='text' name='projetNom' value='$row[9]'>";
    echo'<br>';
    echo'<label>Remise Client :</label>';
    echo"<input type='number' name='clientRemise' value='$row[4]'>%";
    echo'<br>';
    echo '<label>Référence du produit : </label>';
    echo"<input type='text' name='produitRef' value='$row[5]'>";
    echo'<br>';
    echo'<label>Catégorie du produit :</label>';
    echo"<input type='text' name='categorieNom' value='$row[8]'>";
    echo'<br>';
    echo'<label>Description : </label>';
    echo"<input type='text' name='produitDescription' value='$row[7]'>";
    echo'<br>';
    echo'<label>Quantité : </label>';
    echo"<input type='text' name='offreQuantite' value='$row[11]'>";
    echo'<br>';
    echo'<label>P.U : </label>';
    echo"<input type='number' name='produitPu' value='$row[6]'>";
    echo'<br>';
    echo'<label>Commentaires : </label>';
    echo"<input type='text' name='commentaireNom' value='$row[10]'>";
    echo'<br>';
    echo'<label>Total :</label>';
        $quantite=$row[11] ;
        $PU=$row[6];
        $TOTAL_SUM=$quantite*$PU;
    echo"<input for='total'  type='text' name='offreTotal' value='$TOTAL_SUM'>";
    echo'<br>';
     
     
    echo'<input  type="submit" name="Envoyer" value="Envoyer">';
    echo'&nbsp;';
    echo'<input  type="submit" name="Modifier" value="Mise à jour">';
    echo'&nbsp;';
    echo'<input  type="submit" name="enregistrer" value="Enregistrer le pdf">';
     
    echo'</form>';
    echo'</div>';
    j'ai ensuite le script pour le submit 'Envoyer'
    et puis j'ai celui-ci pour la mise à jour:
    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
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    if(isset($_POST['Modifier'])) {
     
        $offreNumero1 = $_POST["offreNumero"];
        $offreDate1 = $_POST["offreDate"];
        $offreFinDate1 = $_POST["offreFinDate"];
        $clientNom1 = $_POST["clientNom"];
        $clientNumero1 = $_POST["clientNumero"];
        $projetNom1 = $_POST["projetNom"];
        $produitRef1 = $_POST["produitRef"];
        $categorieNom1 = $_POST["categorieNom"];
        $produitDescription1 = $_POST["produitDescription"];
        $quantite1 = $_POST["offreQuantite"];
        $produitPu1 = $_POST["produitPu"];
        $clientRemise1 = $_POST["clientRemise"];
        $commentaireNom1 = $_POST["commentaireNom"];
        $total1 = $quantite1 * $produitPu1;
     
        echo '<div class="div_form_MAJ_maj">';
        echo 'Voulez-vous effectuer cette mise a jour?';
        echo '<form action="" method="post">';
        echo '<label>numéro de l\'offre:</label>';
        echo "<input type='text' name='ofNumero' value='$offreNumero1'>";
        echo '<br>';
        echo '<label>date de l\'offre :</label>';
        echo "<input type='date' name='ofDate' value='$offreDate1'>";
        echo '<br>';
        echo '<label>fin de l\'offre : </label>';
        echo "<input type='date' name='ofFinDate' value='$offreFinDate1'>";
        echo '<br>';
        echo '<label>nom du client:</label>';
        echo "<input type='text' name='cNom' value='$clientNom1'>";
        echo '<br>';
        echo '<label>numero du client:</label>';
        echo "<input type='text' name='cNum' value='$clientNumero1'>";
        echo '<br>';
        echo '<label>Projet :</label>';
        echo "<input type='text' name='projeNom' value='$projetNom1'>";
        echo '<br>';
        echo '<label>Remise Client :</label>';
        echo "<input type='number' name='cRemise' value='$clientRemise1'>%";
        echo '<br>';
        echo '<label>Référence du produit : </label>';
        echo "<input type='text' name='produRef' value='$produitRef1'>";
        echo '<br>';
        echo '<label>Catégorie du produit :</label>';
        echo "<input type='text' name='catNom' value='$categorieNom1'>";
        echo '<br>';
        echo '<label>Description : </label>';
        echo "<input type='text' name='produDescription' value='$produitDescription1'>";
        echo '<br>';
        echo '<label>Quantité : </label>';
        echo "<input type='number' name='quantit' value='$quantite1'>";
        echo '<br>';
        echo '<label>P.U : </label>';
        echo "<input type='number' name='prodPu' value='$produitPu1'>";
        echo '<br>';
        echo '<label>Commentaires : </label>';
        echo "<input type='text' name='commentNom' value='$commentaireNom1'>";
        echo '<br>';
        echo '<label>Total :</label>';
        echo "<input type='number' name='tot' value='$total1'>";
        echo '<br>';
     
        echo "<input type='submit' name='OK' value='OK'>";
        echo '&nbsp';
        echo '<input type="submit" name="retour" value="retour">';
        echo '</form>';
        echo '</div>';
     
        if (isset($_POST['OK'])) {
            $objet = new stdClass();
     
            $objet->$clientNom3 = $clientNom1;
            $objet->$numero_client3 = $clientNumero1;
            $objet->$remise3 = $clientRemise1;
     
            $valid = v::attribute('cNom', v::alpha()->notEmpty()->setName('Nom'))
                ->attribute('cNum', v::alnum()->notEmpty()->setName('clientNumero'))
                ->attribute('cRemise', v::numeric()->notEmpty()->setName('clrem'));
            try {
                $valid->assert($objet);
     
     
                $update1 = $bdd->prepare("UPDATE clients SET clientNom=?,clientNumero=?,clientRemise=? ORDER BY clientNumero DESC LIMIT 1");
                $resultat_update1 = $update1->execute(array($objet->clientNom3, $objet->numero_client3, $objet->remise3));
     
                header('Refresh: 5; URL=../doc.php?page=Offres_de_prix');
     
                echo '<p class="p_MAJ_maj" >';
                echo 'Mise à jour effectuée, vous allez être redirigé d\'ici quelques secondes...';
                echo '</p>';
     
     
                /* echo "\nPDO::errorCode(): ", $update1->errorCode();
                 echo "\nPDOStatement::errorInfo():\n";
                 $arr = $update1->errorInfo();
                 print_r($arr);*/
     
            } catch (\InvalidArgumentException $e) {
     
                $objet->error = $e->findMessages([
                    'notEmpty' => '{{name}} veuillez remplir ce champ',
                    'alpha' => '{{name}} ne peut contenir que des lettres',
                    'alnum' => '{{name}} Que des chiffres et des lettres',
                    'numeric' => '{{name}} Que des chiffres',
     
                ]);
                $_SESSION['error'] = $objet->error;
                $_SESSION['data'] = $_POST;
                header('Refresh: 5; URL=./doc.php?page=Offres_de_prix');
                echo '<p class="p_MAJ_maj" >';
                echo 'erreur ';
                echo '</p>';
     
     
            }
        }
        if(isset($_POST['retour'])){
            include 'retour_Script_jung.php';
        }
     
     
    }
    je remplace par exemple mon nom de client,
    donc lorsque je clic sur le submit de mise à jour, cela m'affiche bien un formulaire avec le nouveau nom de client.
    je clic sur le submit OK du formulaire de mise à jour.
    et là bin aucun update dans ma bdd, aucun echo pour me dire s'il a bien enregistré et aucun écho pour me dire echec...
    j'ai essayé:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    echo "\nPDO::errorCode(): ", $update1->errorCode();
                 echo "\nPDOStatement::errorInfo():\n";
                 $arr = $update1->errorInfo();
                 print_r($arr);
    mais je n'ai aucun message...

    tout cela se passe dans le même script

    merci pour votre aide...

  2. #2
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Ton UPDATE est à l'intérieur de la condition if(isset($_POST['Modifier'])) {

  3. #3
    Membre régulier
    Femme Profil pro
    Webdesigner
    Inscrit en
    Juin 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 38
    Localisation : Belgique

    Informations professionnelles :
    Activité : Webdesigner

    Informations forums :
    Inscription : Juin 2014
    Messages : 176
    Points : 74
    Points
    74
    Par défaut
    j'ai donc:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    if(isset($_POST['Modifier'])) {
        // variables + formulaire de mise à jour
        if (isset($_POST['OK'])) {
            //  l'update
        }
    }

  4. #4
    Rédacteur

    Avatar de Bovino
    Homme Profil pro
    Développeur Web
    Inscrit en
    Juin 2008
    Messages
    23 647
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 54
    Localisation : France, Gironde (Aquitaine)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2008
    Messages : 23 647
    Points : 91 220
    Points
    91 220
    Billets dans le blog
    20
    Par défaut
    Oui, mais ce que veux te dire sabotage, c'est qu'il semble difficile d'avoir cliqué à la fois sur le bouton "Modifier" d'un affichage et sur le bouton "OK" d'un autre. Donc tu ne peux jamais entrer dans la condition
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if (isset($_POST['OK'])) {...}

  5. #5
    Membre régulier
    Femme Profil pro
    Webdesigner
    Inscrit en
    Juin 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 38
    Localisation : Belgique

    Informations professionnelles :
    Activité : Webdesigner

    Informations forums :
    Inscription : Juin 2014
    Messages : 176
    Points : 74
    Points
    74
    Par défaut
    je dois alors juste mettre ceci:
    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
    if(isset($_POST['Modifier'])) {
     
        $offreNumero1 = $_POST["offreNumero"];
        $offreDate1 = $_POST["offreDate"];
        $offreFinDate1 = $_POST["offreFinDate"];
        $clientNom1 = $_POST["clientNom"];
        $clientNumero1 = $_POST["clientNumero"];
        $projetNom1 = $_POST["projetNom"];
        $produitRef1 = $_POST["produitRef"];
        $categorieNom1 = $_POST["categorieNom"];
        $produitDescription1 = $_POST["produitDescription"];
        $quantite1 = $_POST["offreQuantite"];
        $produitPu1 = $_POST["produitPu"];
        $clientRemise1 = $_POST["clientRemise"];
        $commentaireNom1 = $_POST["commentaireNom"];
        $total1 = $quantite1 * $produitPu1;
     
        echo '<div class="div_form_MAJ_maj">';
        echo 'Voulez-vous effectuer cette mise a jour?';
        echo '<form action="" method="post">';
        echo '<label>numéro de l\'offre:</label>';
        echo "<input type='text' name='ofNumero' value='$offreNumero1'>";
        echo '<br>';
        echo '<label>date de l\'offre :</label>';
        echo "<input type='date' name='ofDate' value='$offreDate1'>";
        echo '<br>';
        echo '<label>fin de l\'offre : </label>';
        echo "<input type='date' name='ofFinDate' value='$offreFinDate1'>";
        echo '<br>';
        echo '<label>nom du client:</label>';
        echo "<input type='text' name='cNom' value='$clientNom1'>";
        echo '<br>';
        echo '<label>numero du client:</label>';
        echo "<input type='text' name='cNum' value='$clientNumero1'>";
        echo '<br>';
        echo '<label>Projet :</label>';
        echo "<input type='text' name='projeNom' value='$projetNom1'>";
        echo '<br>';
        echo '<label>Remise Client :</label>';
        echo "<input type='number' name='cRemise' value='$clientRemise1'>%";
        echo '<br>';
        echo '<label>Référence du produit : </label>';
        echo "<input type='text' name='produRef' value='$produitRef1'>";
        echo '<br>';
        echo '<label>Catégorie du produit :</label>';
        echo "<input type='text' name='catNom' value='$categorieNom1'>";
        echo '<br>';
        echo '<label>Description : </label>';
        echo "<input type='text' name='produDescription' value='$produitDescription1'>";
        echo '<br>';
        echo '<label>Quantité : </label>';
        echo "<input type='number' name='quantit' value='$quantite1'>";
        echo '<br>';
        echo '<label>P.U : </label>';
        echo "<input type='number' name='prodPu' value='$produitPu1'>";
        echo '<br>';
        echo '<label>Commentaires : </label>';
        echo "<input type='text' name='commentNom' value='$commentaireNom1'>";
        echo '<br>';
        echo '<label>Total :</label>';
        echo "<input type='number' name='tot' value='$total1'>";
        echo '<br>';
     
        echo "<input type='submit' name='OK' value='OK'>";
        echo '&nbsp';
        echo '<input type="submit" name="retour" value="retour">';
        echo '</form>';
        echo '</div>';
    ensuite dans :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    echo '<form action="" method="post">';
    mettre par exemple:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    echo '<form action="script/maj_Script_jung.php" method="post">';
    et dans script/maj_Script_jung.php, y mettre:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    if (isset($_POST['OK'])) {...}
    c'est cela?

  6. #6
    Membre régulier
    Femme Profil pro
    Webdesigner
    Inscrit en
    Juin 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 38
    Localisation : Belgique

    Informations professionnelles :
    Activité : Webdesigner

    Informations forums :
    Inscription : Juin 2014
    Messages : 176
    Points : 74
    Points
    74
    Par défaut
    voilà j'ai séparer les 2 conditions ce qui donne:
    script de départ:
    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
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
     
    include '/bdd_jung.php';
    include "/Validation/vendor/autoload.php";
     
    use Respect\Validation\Validator as v;
     
    $sql=$bdd->prepare('SELECT offre_de_prix.offreNumero,offre_de_prix.offreDate, offre_de_prix.offreFinDate, clients.clientNom,clients.clientRemise,produits.produitRef,produits.produitPu,produits.produitDescription,categorie.categorieNom,projet.projetNom,commentaires.commentaireNom,offre_de_prix.offreQuantite,offre_de_prix.offreTotal,clients.clientNumero FROM offre_de_prix, clients, produits, categorie, projet, commentaires WHERE offre_de_prix.clientID=clients.clientID AND projet.clientID=clients.clientID AND produits.categorieId=categorie.categorieId ORDER BY offreNumero DESC LIMIT 1');
    $reslt=$sql->execute();
    $row = $sql->fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_NEXT);
     
    echo '<div class="form_inscription">';
    echo'<h3>formulaire d\'offres de prix, inscription :</h3>';
    echo'<form action="" method="post">';
    echo'<label>numéro de l\'offre:</label>';
    echo"<input type='text' name='offreNumero' value='$row[0]'>";
    echo'<br>';
    echo'<label>date de l\'offre :</label>';
    echo"<input type='date' name='offreDate' value='$row[1]'>";
    echo'<br>';
    echo'<label>fin de l\'offre : </label>';
    echo"<input type='date' name='offreFinDate' value='$row[2]'>";
    echo'<br>';
    echo'<label for="clientNom">nom du client:</label>';
    echo"<input id='clientNom' type='text' name='clientNom' value='$row[3]'>";
    echo'<br>';
    echo'<label>numero du client:</label>';
    echo"<input type='text' name='clientNumero' value='$row[13]'>";
    echo'<br>';
    echo'<label>Projet :</label>';
    echo"<input type='text' name='projetNom' value='$row[9]'>";
    echo'<br>';
    echo'<label>Remise Client :</label>';
    echo"<input type='number' name='clientRemise' value='$row[4]'>%";
    echo'<br>';
    echo '<label>Référence du produit : </label>';
    echo"<input type='text' name='produitRef' value='$row[5]'>";
    echo'<br>';
    echo'<label>Catégorie du produit :</label>';
    echo"<input type='text' name='categorieNom' value='$row[8]'>";
    echo'<br>';
    echo'<label>Description : </label>';
    echo"<input type='text' name='produitDescription' value='$row[7]'>";
    echo'<br>';
    echo'<label>Quantité : </label>';
    echo"<input type='text' name='offreQuantite' value='$row[11]'>";
    echo'<br>';
    echo'<label>P.U : </label>';
    echo"<input type='number' name='produitPu' value='$row[6]'>";
    echo'<br>';
    echo'<label>Commentaires : </label>';
    echo"<input type='text' name='commentaireNom' value='$row[10]'>";
    echo'<br>';
    echo'<label>Total :</label>';
        $quantite=$row[11] ;
        $PU=$row[6];
        $TOTAL_SUM=$quantite*$PU;
    echo"<input for='total'  type='text' name='offreTotal' value='$TOTAL_SUM'>";
    echo'<br>';
     
     
    echo'<input  type="submit" name="Envoyer" value="Envoyer">';
    echo'&nbsp;';
    echo'<input  type="submit" name="Modifier" value="Mise à jour">';
    echo'&nbsp;';
    echo'<input  type="submit" name="enregistrer" value="Enregistrer le pdf">';
     
    echo'</form>';
    echo'</div>';
     
     
    if(isset($_POST['Modifier'])) {
     
        $offreNumero1 = $_POST["offreNumero"];
        $offreDate1 = $_POST["offreDate"];
        $offreFinDate1 = $_POST["offreFinDate"];
        $clientNom1 = $_POST["clientNom"];
        $clientNumero1 = $_POST["clientNumero"];
        $projetNom1 = $_POST["projetNom"];
        $produitRef1 = $_POST["produitRef"];
        $categorieNom1 = $_POST["categorieNom"];
        $produitDescription1 = $_POST["produitDescription"];
        $quantite1 = $_POST["offreQuantite"];
        $produitPu1 = $_POST["produitPu"];
        $clientRemise1 = $_POST["clientRemise"];
        $commentaireNom1 = $_POST["commentaireNom"];
        $total1 = $quantite1 * $produitPu1;
     
        echo '<div class="div_form_MAJ_maj">';
        echo 'Voulez-vous effectuer cette mise a jour?';
        echo '<form action="script/maj_Script_jung.php" method="post">';
        echo '<label>numéro de l\'offre:</label>';
        echo "<input type='text' name='ofNumero' value='$offreNumero1'>";
        echo '<br>';
        echo '<label>date de l\'offre :</label>';
        echo "<input type='date' name='ofDate' value='$offreDate1'>";
        echo '<br>';
        echo '<label>fin de l\'offre : </label>';
        echo "<input type='date' name='ofFinDate' value='$offreFinDate1'>";
        echo '<br>';
        echo '<label>nom du client:</label>';
        echo "<input type='text' name='cNom' value='$clientNom1'>";
        echo '<br>';
        echo '<label>numero du client:</label>';
        echo "<input type='text' name='cNum' value='$clientNumero1'>";
        echo '<br>';
        echo '<label>Projet :</label>';
        echo "<input type='text' name='projeNom' value='$projetNom1'>";
        echo '<br>';
        echo '<label>Remise Client :</label>';
        echo "<input type='number' name='cRemise' value='$clientRemise1'>%";
        echo '<br>';
        echo '<label>Référence du produit : </label>';
        echo "<input type='text' name='produRef' value='$produitRef1'>";
        echo '<br>';
        echo '<label>Catégorie du produit :</label>';
        echo "<input type='text' name='catNom' value='$categorieNom1'>";
        echo '<br>';
        echo '<label>Description : </label>';
        echo "<input type='text' name='produDescription' value='$produitDescription1'>";
        echo '<br>';
        echo '<label>Quantité : </label>';
        echo "<input type='number' name='quantit' value='$quantite1'>";
        echo '<br>';
        echo '<label>P.U : </label>';
        echo "<input type='number' name='prodPu' value='$produitPu1'>";
        echo '<br>';
        echo '<label>Commentaires : </label>';
        echo "<input type='text' name='commentNom' value='$commentaireNom1'>";
        echo '<br>';
        echo '<label>Total :</label>';
        echo "<input type='number' name='tot' value='$total1'>";
        echo '<br>';
     
        echo "<input type='submit' name='OK' value='OK'>";
        echo '&nbsp';
        echo '<input type="submit" name="retour" value="retour">';
        echo '</form>';
        echo '</div>';
     
     
     
     
    }
    maj_Script_jung.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
     
    include '../bdd_jung.php';
    include "../Validation/vendor/autoload.php";
     
    use Respect\Validation\Validator as v;
     
    if (isset($_POST['OK'])) {
     
     
        $objet = new stdClass();
     
        $objet->$clientNom3 = $_POST['cNom'];
        $objet->$numero_client3 = $_POST['cNum'];
        $objet->$remise3 = $_POST['cRemise'];
     
        $valid = v::attribute('cNom', v::alpha()->notEmpty()->setName('Nom'))
            ->attribute('cNum', v::alnum()->notEmpty()->setName('clientNumero'))
            ->attribute('cRemise', v::numeric()->notEmpty()->setName('clrem'));
        //var_dump($valid,$objet);
        try {
            $valid->assert($objet);
     
     
            $update1 = $bdd->prepare("UPDATE clients SET clientNom=?,clientNumero=?,clientRemise=? ORDER BY clientNumero DESC LIMIT 1");
            $resultat_update1 = $update1->execute(array($objet->clientNom3, $objet->numero_client3, $objet->remise3));
     
            header('Refresh: 5; URL=../doc.php?page=Offres_de_prix');
     
            echo '<p class="p_MAJ_maj" >';
            echo 'Mise à jour effectuée, vous allez être redirigé d\'ici quelques secondes...';
            echo '</p>';
     
     
             /*echo "\nPDO::errorCode(): ", $update1->errorCode();
             echo "\nPDOStatement::errorInfo():\n";
             $arr = $update1->errorInfo();
             print_r($arr);*/
     
        } catch (\InvalidArgumentException $e) {
     
            $objet->error = $e->findMessages([
                'notEmpty' => '{{name}} veuillez remplir ce champ',
                'alpha' => '{{name}} ne peut contenir que des lettres',
                'alnum' => '{{name}} Que des chiffres et des lettres',
                'numeric' => '{{name}} Que des chiffres',
     
            ]);
            $_SESSION['error'] = $objet->error;
            $_SESSION['data'] = $_POST;
            header('Refresh: 5; URL=./doc.php?page=Offres_de_prix');
            echo '<p class="p_MAJ_maj" >';
            echo 'erreur ';
            echo '</p>';
     
     
        }
    }
    if(isset($_POST['retour'])){
        include 'retour_Script_jung.php';
    }
    erreur:

    ( ! ) Notice: Undefined variable: clientNom3 in C:\wamp\www\Jung-Distribution\script\maj_Script_jung.php on line 12
    Call Stack
    # Time Memory Function Location
    1 0.0046 150224 {main}( ) ..\maj_Script_jung.php:0

    ( ! ) Fatal error: Cannot access empty property in C:\wamp\www\Jung-Distribution\script\maj_Script_jung.php on line 12
    Call Stack
    # Time Memory Function Location
    1 0.0046 150224 {main}( ) ..\maj_Script_jung.php:0
    la ligne 12:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    $objet->$clientNom3 = $_POST['cNom'];

  7. #7
    Modérateur
    Avatar de sabotage
    Homme Profil pro
    Inscrit en
    Juillet 2005
    Messages
    29 208
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Juillet 2005
    Messages : 29 208
    Points : 44 155
    Points
    44 155
    Par défaut
    Tu as un $ en trop

  8. #8
    Membre régulier
    Femme Profil pro
    Webdesigner
    Inscrit en
    Juin 2014
    Messages
    176
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 38
    Localisation : Belgique

    Informations professionnelles :
    Activité : Webdesigner

    Informations forums :
    Inscription : Juin 2014
    Messages : 176
    Points : 74
    Points
    74
    Par défaut
    merci à force de scruter tout le code, et à chercher des erreurs plus complexe je suis passée à côté d'une bête erreur!
    et le pire c'est que cela me le disait bien: variable clientNom3 non définie...pffff

    maintenant c'est prit en compte, mon script m'indique maintenant l echo erreur, mais ça je pense que c'est à cause que ma requete est mal construite , je vais chercher ^^


    encore merci!

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 2
    Dernier message: 08/04/2008, 16h29
  2. Ne pas afficher un Message d'erreur
    Par titeZ dans le forum Macros et VBA Excel
    Réponses: 5
    Dernier message: 24/08/2007, 13h39
  3. [SQLK][Trigger DDL]Ne pas montrer de message d'erreur
    Par elsuket dans le forum MS SQL Server
    Réponses: 0
    Dernier message: 10/08/2007, 07h53
  4. [MySQL] je n'arrive pas à interpréter le message d'erreur de MySQL ?
    Par jojojojo57 dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 29/05/2007, 19h14
  5. j'arrive pas à comprendre ce Message d'erreur
    Par casho dans le forum Servlets/JSP
    Réponses: 1
    Dernier message: 11/12/2006, 10h00

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo