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

PHP & Base de données Discussion :

un erreur du php


Sujet :

PHP & Base de données

  1. #1
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2011
    Messages : 13
    Points : 4
    Points
    4
    Par défaut un erreur du php
    salut a tout
    c'est une erreur du php ou niveau du l'insertion dans la base
    on fait c'est un tableau dynamique qui ajoute une ligne
    mais la problème c'est de récupérer les données du table
    voila le code du tableau
    l'erreur dans la 2eme code '".$_POST['num'][$i]."',
    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
     
    var indice = 0;
    function ajoute_ligne()
    {
    indice ++;
    emplacement = document.getElementById("mon_tableau");
     
    //-- création d'une ligne ----------
    elem = document.createElement("TR");
    ligne = emplacement.appendChild(elem);
     
    //-- création de 3 cellules --------
     
     
    elem = document.createElement("Td");
    cellule = ligne.appendChild(elem);
    elem = document.createElement("Td");
    cellule1 = ligne.appendChild(elem);
    elem = document.createElement("Td");
    cellule2 = ligne.appendChild(elem);
    elem = document.createElement("Td");
    cellule3 = ligne.appendChild(elem);
    elem = document.createElement("Td");
    cellule4 = ligne.appendChild(elem);
     
    //'<input name="motif_intervention[' + indice + ']" type="text" id="motif_intervention[' + indice + ']" maxlength="60" size="30">'; 
     
    cellule.innerHTML ='<input type="text"  name="num[' + indice + ']" value= "'+ indice + '"  size=3>';
    cellule1.innerHTML ='<textarea name= "description[' + indice + ']" cols="20" rows="5"></textarea>';
    cellule2.innerHTML ='<input type="text " name="t_prevu[' + indice + ']" size="10" >';
    cellule3.innerHTML ='<input type="text"  name="t_realisé[' + indice + ']" size="10" >';
    cellule4.innerHTML ='<textarea name=  "obs[' + indice +']" cols="20" rows="5"></textarea>';
     
    }
    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
     
    <?php
    $d = date("Y/m/d");
       $i = 1;
    	$nb = $_POST['num'];
    	echo $nb;
    	for($i=0;$i<sizeof($nb);$i++)
    	{
     
    	$insertSQL2 = "INSERT INTO ligne_dem_trav 
    	VALUES('',
    	  '".$_POST['num'][$i]."', 
    	 '".$_POST['description'][$i]."',
    	  '".$_POST['t_prevu'][$i]."', 
    	 '".$_POST['t_realisé'][$i]."', 
    	 '".$_POST['obs'][$i]."',
    	  '".$d."')";
     
     
    	$Result2 = mysql_query($insertSQL2) or die(mysql_error());						
     
     
     
    	}
     
    ?>

  2. #2
    Expert éminent
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 101
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 101
    Points : 8 211
    Points
    8 211
    Billets dans le blog
    17
    Par défaut
    Quel est le problème ?
    Déjà fais un print_r($_POST) pour voir si le script reçoit bien les données attendues.
    Un problème exposé clairement est déjà à moitié résolu
    Keep It Smart and Simple

  3. #3
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2011
    Messages : 13
    Points : 4
    Points
    4
    Par défaut
    voila le message du erreur
    Notice: Undefined index: description in E:\wamp\www\in-admin-paneloriginal\ajout_demande_travail.php
    je c'est pas qu'elle est le problème!!!!

  4. #4
    Expert éminent
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 101
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 101
    Points : 8 211
    Points
    8 211
    Billets dans le blog
    17
    Par défaut
    Citation Envoyé par kazamed Voir le message
    voila le message du erreur
    Notice: Undefined index: description in E:\wamp\www\in-admin-paneloriginal\ajout_demande_travail.php
    je c'est pas qu'elle est le problème!!!!
    $_POST['description'] n'existe pas.
    T'as fait un print_r( ) ? T'es sûr de ton formulaire ?
    Un problème exposé clairement est déjà à moitié résolu
    Keep It Smart and Simple

  5. #5
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2011
    Messages : 13
    Points : 4
    Points
    4
    Par défaut oui
    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
     
    function supprime_ligne()
    {
    emplacement = document.getElementById("mon_tableau");
    if (! emplacement.hasChildNodes()) return;
     
    //-- effacement de la dernière ligne ----------
    ligne = emplacement.getElementsByTagName("TR");
    emplacement.removeChild(ligne.item(ligne.length - 1));
    }
    //-->
     	</script> 
     
    <script language="javascript" type="text/javascript" src="chefmaint/niceforms.js"></script>
    <link rel="stylesheet" type="text/css" media="all" href="chefmaint/niceforms-default.css" />
     
    </head>
    <body>
     
    <div id="main_container">
     
     
       <div id="clock_a"></div>
    	<div class="header">
        <div class="logo"><a href="#"><img src="images/logo.gif" alt="" width="242" height="62" border="0" title="" /></a></div>
     
     
    <?php
    session_start();
    include("session.php");
     
     
    ?>    
     
     
     
    		      <div class="form">
             <form action="ajout_demande_travail.php" method="POST" class="niceform"> 
                <table width="148%" height="115" border="0">
                <tr> 
                <td width="10%" height="36"><strong>Exucution par:</strong></td>
                <strong> 
    			<?php
               echo" <td width='19%'><input type='text' name='ex' value='$n '></td>";
                ?>
    			</strong> 
                  <td width="16%">&nbsp;</td>
                <strong> 
                  <td width="16%"><strong> Type Intervention:</strong></td>
                <td width="11%"><select name="int">
                    <option  value='PREVENTIVE'>PREVENTIVE</option>
                    <option  value='CURATIVE'>CURATIVE</option>
                  </select></td>
    			  <th>Date:</th>
    			 <td width="27%"> <?php
    			$d = date("Y/m/d");
                  echo "<input type='text' name='dat'  value='$d'id='date'>";
                  ?></td>
                </strong> </tr>
              <tr> <strong> 
     
                </strong> </tr>
              <tr> <strong> 
     
                  <td width="10%" height="43"><strong>Machine:</strong></td>
                </strong> 
                  <td><strong><select name="mach">
                      <option  value='JUMPER'>JUMPER</option>
                      <option  value='RADIAL'>RADIAL</option>
    				  <option  value='VCD'>VCD</option>
    				  <option  value='VCS'>VCS</option>
                    </select> </strong></td>
    			  <td></td>
     
                  <td><strong>N&deg;_demande</strong></td>
    			<td width="20%">
     
    			<?php
     
    			$query="SELECT num__dem_tra FROM dem_tra ORDER BY num__dem_tra DESC LIMIT 0,1";
    			$sqlq=mysql_query($query);
    			$x= mysql_result($sqlq,0 );
    			$x=$x+1;
    			echo" <input type='text' name='num_d' value='$x ' id='num_acha'></td>" ;
     
    			?>
              </tr>
            </table></p>
              <h2 align="center">Tableau du travail:</h2> 
              <table width="730" height="37" id="rounded-corner" summary="2007 Major IT Companies' Profit">
                <thead>
              <tr> 
     
                 <th width="100" class="rounded-company" scope="col">n°</th>
                <th width="100" class="rounded" scope="col">Desingation</th>
                <th  width="72" class="rounded" scope="col">temps_prevu</th>
                <th width="72" class="rounded" scope="col">temps_réalisé</th>
    			 <th width="72" class="rounded_q4" scope="col">Observation</th>
     
     
     
              </tr>
            </thead>
            <tfoot><tbody id="mon_tableau">
            </table>
    </tbody>
    </table>
    <table align="center" width="114%">
    <tr>
    <td align="center">
     
    <input type="button" value="Ajouter une ligne" onclick="ajoute_ligne()" />
    </td>
    <td align="center">
    <input type="button" value="Supprimer une ligne" onclick="supprime_ligne()" />
    </td>
     
    </tr>
    </table></p>
            <span class="bt_green_r"></span></a> <a href="javascript:imprimer()" class="bt_blue"><span class="bt_blue_lft"></span>
    		<strong>IMPRIMER</strong><span class="bt_blue_r"></span></a>
     
     
     
                    <fieldset>
                            <dt>
     
                         <dl class="submit">
                        <input type="submit" name="submit" id="submit" value="Enregistrer" />
                         </dl>       
                   </fieldset>     
             </form>
             </div>

  6. #6
    Expert éminent
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 101
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 101
    Points : 8 211
    Points
    8 211
    Billets dans le blog
    17
    Par défaut
    1. Trop de code, va falloir élaguer si tu veux que je t'aide
    2. Je ne vois pas de print_r( ) http://www.php.net/print-r
    Un problème exposé clairement est déjà à moitié résolu
    Keep It Smart and Simple

  7. #7
    Membre régulier
    Homme Profil pro
    Analyse système
    Inscrit en
    Mars 2011
    Messages
    444
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Analyse système

    Informations forums :
    Inscription : Mars 2011
    Messages : 444
    Points : 108
    Points
    108
    Par défaut
    peut être tu devras concaténer :


  8. #8
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2011
    Messages : 13
    Points : 4
    Points
    4
    Par défaut oui c'est bon merci !!
    j'ai un autre erreur c'est comment récupérer le nombre du ligne du tableau
    la variable et en javascript
    et l'insertion en 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
     
     $i = 1;
    	$nb = sizeof("$_POST['description'][$i]");
    	//echo $nb;
     
    	while ($i <= $nb)
    	{
    		//, '".$_POST['motif_intervention'][$i]."',
    	$insertSQL2 = "INSERT INTO ligne_dem_trav 
    	VALUES('$num_d',
    	 '$i', 
    	 '".$_POST['description'][$i]."', 
    	 '".$_POST['t_prevu'][$i]."', 
    	 '".$_POST['t_realisé'][$i]."', 
    	 '".$_POST['obs'][$i]."',
    	  '".$d."')"or die(mysql_error());
     
     
    	$Result2 = mysql_query($insertSQL2) or die(mysql_error());
    	$i++;						
    	echo "$insertSQL2<br>";
     
     
     
    	}
     
    ?>
    l'erreur dans cette recette
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     $nb = sizeof("$_POST['description'][$i]");
    sizeof renvoi le nombre de ligne du table !!

  9. #9
    Expert éminent
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 101
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 101
    Points : 8 211
    Points
    8 211
    Billets dans le blog
    17
    Par défaut
    sizeof( ) attend un tableau en paramètre, pas une chaîne de caractères ;-)

    http://www.php.net/sizeof
    http://www.php.net/count
    Un problème exposé clairement est déjà à moitié résolu
    Keep It Smart and Simple

  10. #10
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2011
    Messages : 13
    Points : 4
    Points
    4
    Par défaut merci pour la réponse
    alors comment peut-on récupérer le nombre de ligne du tableau ?????

  11. #11
    Expert éminent
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 101
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 101
    Points : 8 211
    Points
    8 211
    Billets dans le blog
    17
    Par défaut
    En envoyant un tableau à sizeof/count, et pas une chaîne de caractères comme tu le fais.
    Il y a des exemples dans la doc PHP.
    Un problème exposé clairement est déjà à moitié résolu
    Keep It Smart and Simple

  12. #12
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2011
    Messages : 13
    Points : 4
    Points
    4
    Par défaut
    j'ai trouver une solution
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
      $a=$_POST['description$i'];
    	$nb =  count($a);
    mas la variable escription$i' n'est pas dans la boucle
    while ($i <= $nb)
    et $nb c'est la résultat du $nb = count($a);
    c'est ca mon problème !!

  13. #13
    Expert éminent
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 101
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 101
    Points : 8 211
    Points
    8 211
    Billets dans le blog
    17
    Par défaut
    Re,
    Il te manque les bases de PHP

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $nb = sizeof("$_POST['description'][$i]");
    Pourquoi des " autour de $_POST ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    $a=$_POST['description$i'];
    Pourquoi des ' et pas des " dans $_POST ? Pourquoi $i ici et pas ailleurs ?
    Au mieux tu te retrouverais avec
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    $_POST['description123']
    , je ne pense pas que $_POST contienne un tableau indexé à la clef "description123"
    Un problème exposé clairement est déjà à moitié résolu
    Keep It Smart and Simple

  14. #14
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2011
    Messages : 13
    Points : 4
    Points
    4
    Par défaut
    oui c'est vrais
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     $a=$_POST['description'].[$i];
    	$nb = sizeof("$a");
    elle retourne une erreur
    Parse error: syntax error, unexpected '[' in
    je trouve pas comment récupérer l'indice du tableau

  15. #15
    Expert éminent
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 101
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 101
    Points : 8 211
    Points
    8 211
    Billets dans le blog
    17
    Par défaut
    Citation Envoyé par kazamed Voir le message
    oui c'est vrais
    $a=$_POST['description'].[$i];
    http://fr2.php.net/manual/fr/language.types.array.php : tu verras comment accéder aux éléments d'un tableau multidimensionnel.

    $nb = sizeof("$a");
    sizeof( ) attend un tableau et pas une chaine de caractères.
    Une chaîne de caractères est délimitée avec des " ou des ', pourquoi en mets-tu ?
    Un problème exposé clairement est déjà à moitié résolu
    Keep It Smart and Simple

  16. #16
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2011
    Messages : 13
    Points : 4
    Points
    4
    Par défaut voila ma page1
    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
     
    var indice = 0;
    function ajoute_ligne()
    {
    indice ++;
    emplacement = document.getElementById("mon_tableau");
     
    //-- création d'une ligne ----------
    elem = document.createElement("TR");
    ligne = emplacement.appendChild(elem);
     
    //-- création de 3 cellules --------
     
     
    elem = document.createElement("Td");
    cellule = ligne.appendChild(elem);
    elem = document.createElement("Td");
    cellule1 = ligne.appendChild(elem);
    elem = document.createElement("Td");
    cellule2 = ligne.appendChild(elem);
    elem = document.createElement("Td");
    cellule3 = ligne.appendChild(elem);
    elem = document.createElement("Td");
    cellule4 = ligne.appendChild(elem);
     
    cellule.innerHTML ='<input type="text"  name=" num " value= "['+ indice + ']"  size=3>';
    cellule1.innerHTML ='<textarea name= "description[' +indice+']"  cols="20" rows="5"></textarea>';
    cellule2.innerHTML ='<input type="text " name="t_prevu[' + indice + ']"  size="10" >';
    cellule3.innerHTML ='<input type="text"  name="t_realisé[' + indice + ']" size="10" >';
    cellule4.innerHTML ='<textarea name= "obs[' + indice +']" cols="20" rows="5"></textarea>';
     
    }	
     
     
    function supprime_ligne()
    {
    emplacement = document.getElementById("mon_tableau");
    if (! emplacement.hasChildNodes()) return;
     
    //-- effacement de la dernière ligne ----------
    ligne = emplacement.getElementsByTagName("TR");
    emplacement.removeChild(ligne.item(ligne.length - 1));
    }
    //-->
     	</script>
    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
     
     
    		      <div class="form">
             <form name="f" action="ajout_demande_travail.php" method="POST" class="niceform"> 
     
              <table width="162%" height="127" border="0">
                <tr> 
                <td width="10%" height="36"><strong>Exucution par:</strong></td>
                <strong> 
    			<?php
               echo" <td width='19%'><input type='text' name='ex' value='$n '></td>";
                ?>
    			</strong> 
                  <td width="13%">&nbsp;</td>
                <strong> 
                  <td width="11%"><strong> Type Intervention:</strong></td>
                <td width="13%"><select name="int">
                    <option  value='PREVENTIVE'>PREVENTIVE</option>
                    <option  value='CURATIVE'>CURATIVE</option>
                  </select></td>
    			  <th>Date:</th>
    			 <td width="36%"> <?php
    			$d = date("Y/m/d");
                  echo "<input type='text' name='dat'  value='$d'id='date'>";
                  ?></td>
                </strong> </tr>
              <tr> <strong> 
     
                </strong> </tr>
              <tr> <strong> 
     
                  <td width="10%" height="43"><strong>Machine:</strong></td>
                </strong> 
                  <td><strong><select name="mach">
                      <option  value='JUMPER'>JUMPER</option>
                      <option  value='RADIAL'>RADIAL</option>
    				  <option  value='VCD'>VCD</option>
    				  <option  value='VCS'>VCS</option>
                    </select> </strong></td>
    			  <td></td>
     
                  <td><strong>N&deg;_demande</strong></td>
    			<td width="17%">
     
    			<?php
     
    			$query="SELECT num__dem_tra FROM dem_tra ORDER BY num__dem_tra DESC LIMIT 0,1";
    			$sqlq=mysql_query($query);
    			$x= mysql_result($sqlq,0 );
    			$x=$x+1;
    			echo" <input type='text' name='num' value='$x ' id='num'></td>" ;
     
    			?>
    			</td>
    			<td> </tr>
            </table>
    		</a>
              <div align="center"><a href="javascript:imprimer()" class="bt_blue"> 
                <span class="bt_blue_lft"></span><strong>IMPRIMER</strong><span class="bt_blue_r"></span></a></td> </p> 
              </div>
     
              <h2 align="center">Tableau du travail:</h2> 
     
     
              <table width="730" height="37" id="rounded-corner" summary="2007 Major IT Companies' Profit">
                <thead>
              <tr> 
     
                 <th width="100" class="rounded-company" scope="col">n°</th>
                <th width="100" class="rounded" scope="col">Desingation</th>
                <th  width="72" class="rounded" scope="col">temps_prevu</th>
                <th width="72" class="rounded" scope="col">temps_réalisé</th>
    			 <th width="72" class="rounded_q4" scope="col">Observation</th>
    			     </tr>
    			<tr>
    			<td><input type="text"  name=" num[0]"   value= "0"  size=3></td>
    <td><textarea name= "description0"  cols="20" rows="5"></textarea></td>
    <td><input type="text " name="t_prevu[0]"  size="10" ></td>
    <td><input type="text"  name="t_realisé[0]" size="10" ></td>
    <td><textarea name= "obs[0]" cols="20" rows="5"></textarea></td>
     
           </tr>
            </thead>
            <tfoot><tbody id="mon_tableau">
            </table>
    </tbody>
    </table>
    <table align="center" width="114%">
    <tr>
    <td align="center">
     
    <input type="button" value="Ajouter une ligne" onclick="ajoute_ligne()" />
    </td>
    <td align="center">
    <input type="button" value="Supprimer une ligne" onclick="supprime_ligne()" />
    </td>
     
    </tr>
    </table>
    j'ai met "" pou recuperé le nom du imput text!!
    et voila la page ajout.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
     
    <?php
    session_start();
     
    include("session.php");
     $i = 0;
       $a=$_POST[description].[$i];
    	$nb = sizeof("$a");
    	echo $nb;
     
    	while ($i <= $nb)
    	{
    	$insertSQL2 = "INSERT INTO ligne_dem_trav 
    	VALUES('".$num_d."','$i', 
    	 '".$_POST['description'][$i]."', 
    	 '".$_POST['t_prevu'][$i]."', 
    	 '".$_POST['t_realisé'][$i]."', 
    	 '".$_POST['obs'][$i]."',
    	  '".$d."')"or die(mysql_error());
     
     
    	$Result2 = mysql_query($insertSQL2) or die(mysql_error());
    	$i++;						
    	echo "$insertSQL2<br>";
     
     
     
    	}
     
    ?>

  17. #17
    Expert éminent
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 101
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 101
    Points : 8 211
    Points
    8 211
    Billets dans le blog
    17
    Par défaut
    j'ai met "" pou recuperé le nom du imput text!!
    Je ne sais pas à quoi tu réponds.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    $a=$_POST[description].[$i];
    $nb = sizeof("$a");
    Toujours les mêmes problèmes de syntaxe/programmation. Il faut lire la documentation PHP ou tes cours, tout le monde est passé par là

    Pas lu le reste, trop de code.
    Un problème exposé clairement est déjà à moitié résolu
    Keep It Smart and Simple

  18. #18
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2011
    Messages : 13
    Points : 4
    Points
    4
    Par défaut
    ok merci our la documentation PHP

  19. #19
    Candidat au Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Mai 2011
    Messages
    13
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Mai 2011
    Messages : 13
    Points : 4
    Points
    4
    Par défaut
    j'ai une question on peut pas récupéré une variable coder par javascript en php??
    ci possible comment !!

  20. #20
    Expert éminent
    Avatar de Séb.
    Profil pro
    Inscrit en
    Mars 2005
    Messages
    5 101
    Détails du profil
    Informations personnelles :
    Âge : 46
    Localisation : France

    Informations professionnelles :
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Mars 2005
    Messages : 5 101
    Points : 8 211
    Points
    8 211
    Billets dans le blog
    17
    Par défaut
    Citation Envoyé par kazamed Voir le message
    j'ai une question on peut pas récupéré une variable coder par javascript en php??
    C'est possible oui, mais il faut soumettre une requête au serveur (formulaire, AJAX/XmlHttpRequest).
    Un problème exposé clairement est déjà à moitié résolu
    Keep It Smart and Simple

Discussions similaires

  1. Erreur sous PHP MyAdmin (PMA database?)
    Par Matlight dans le forum Installation
    Réponses: 5
    Dernier message: 28/10/2010, 19h38
  2. Message d'erreur page PHP et MySQL
    Par littlesnoopy dans le forum Installation
    Réponses: 6
    Dernier message: 19/01/2007, 10h25
  3. [Upload] AFFICHAGE ERREUR upload.php
    Par cherifa dans le forum Langage
    Réponses: 1
    Dernier message: 17/09/2006, 15h29
  4. aider à corriger une erreur de php
    Par LeYouss dans le forum Langage
    Réponses: 3
    Dernier message: 27/04/2006, 18h04
  5. Erreur en PHP
    Par rane dans le forum Langage
    Réponses: 8
    Dernier message: 27/04/2006, 11h38

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