Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD > PHP & MySQL
PHP & MySQL Forum d'entraide sur les fonctions MySQL avec PHP. Avant de poster -> FAQ MySQL, Cours MySQL et Sources MySQL. Pour les questions concernant le moteur MySQL plutôt que les fonctions PHP, merci d'utiliser le forum MySQL.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 12/05/2011, 14h58   #1
Invité de passage
 
Homme kazamed
Étudiant
Inscription : mai 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme kazamed
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 13
Points : 1
Points : 1
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 :
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 :
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());						
 
 
 
	}
 
?>
kazamed est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/05/2011, 16h42   #2
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 823
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

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

Informations forums :
Inscription : mars 2005
Messages : 2 823
Points : 3 449
Points : 3 449
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
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/05/2011, 20h54   #3
Invité de passage
 
Homme kazamed
Étudiant
Inscription : mai 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme kazamed
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 13
Points : 1
Points : 1
voila le message du erreur
Citation:
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!!!!
kazamed est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/05/2011, 22h27   #4
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 823
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

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

Informations forums :
Inscription : mars 2005
Messages : 2 823
Points : 3 449
Points : 3 449
Citation:
Envoyé par kazamed Voir le message
voila le message du erreur
Citation:
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
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/05/2011, 22h42   #5
Invité de passage
 
Homme kazamed
Étudiant
Inscription : mai 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme kazamed
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 13
Points : 1
Points : 1
Par défaut oui

Code :
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>
kazamed est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/05/2011, 22h57   #6
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 823
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

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

Informations forums :
Inscription : mars 2005
Messages : 2 823
Points : 3 449
Points : 3 449
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
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 13/05/2011, 18h02   #7
Membre du Club
 
Homme
Analyse système
Inscription : mars 2011
Messages : 406
Détails du profil
Informations personnelles :
Sexe : Homme

Informations professionnelles :
Activité : Analyse système

Informations forums :
Inscription : mars 2011
Messages : 406
Points : 67
Points : 67
peut être tu devras concaténer :

benhsaien est déconnecté   Envoyer un message privé Réponse avec citation 01
Vieux 14/05/2011, 12h38   #8
Invité de passage
 
Homme kazamed
Étudiant
Inscription : mai 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme kazamed
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 13
Points : 1
Points : 1
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 :
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 :
 $nb = sizeof("$_POST['description'][$i]");
sizeof renvoi le nombre de ligne du table !!
kazamed est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 12h46   #9
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 823
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

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

Informations forums :
Inscription : mars 2005
Messages : 2 823
Points : 3 449
Points : 3 449
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
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 13h08   #10
Invité de passage
 
Homme kazamed
Étudiant
Inscription : mai 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme kazamed
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 13
Points : 1
Points : 1
Par défaut merci pour la réponse

alors comment peut-on récupérer le nombre de ligne du tableau ?????
kazamed est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 13h11   #11
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 823
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

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

Informations forums :
Inscription : mars 2005
Messages : 2 823
Points : 3 449
Points : 3 449
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
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 13h15   #12
Invité de passage
 
Homme kazamed
Étudiant
Inscription : mai 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme kazamed
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 13
Points : 1
Points : 1
j'ai trouver une solution
Code :
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 !!
kazamed est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 13h18   #13
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 823
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

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

Informations forums :
Inscription : mars 2005
Messages : 2 823
Points : 3 449
Points : 3 449
Re,
Il te manque les bases de PHP

Code :
$nb = sizeof("$_POST['description'][$i]");
Pourquoi des " autour de $_POST ?
Code :
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 :
$_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
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 13h28   #14
Invité de passage
 
Homme kazamed
Étudiant
Inscription : mai 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme kazamed
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 13
Points : 1
Points : 1
oui c'est vrais
Code :
1
2
 $a=$_POST['description'].[$i];
	$nb = sizeof("$a");
elle retourne une erreur
Citation:
Parse error: syntax error, unexpected '[' in
je trouve pas comment récupérer l'indice du tableau
kazamed est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 13h40   #15
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 823
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

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

Informations forums :
Inscription : mars 2005
Messages : 2 823
Points : 3 449
Points : 3 449
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.

Citation:
$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
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 13h54   #16
Invité de passage
 
Homme kazamed
Étudiant
Inscription : mai 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme kazamed
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 13
Points : 1
Points : 1
Par défaut voila ma page1

Code :
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 :
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 :
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>";
 
 
 
	}
 
?>
kazamed est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 14h04   #17
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 823
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

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

Informations forums :
Inscription : mars 2005
Messages : 2 823
Points : 3 449
Points : 3 449
Citation:
j'ai met "" pou recuperé le nom du imput text!!
Je ne sais pas à quoi tu réponds.

Code :
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
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 14h10   #18
Invité de passage
 
Homme kazamed
Étudiant
Inscription : mai 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme kazamed
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 13
Points : 1
Points : 1
ok merci our la documentation PHP
kazamed est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 14h14   #19
Invité de passage
 
Homme kazamed
Étudiant
Inscription : mai 2011
Messages : 13
Détails du profil
Informations personnelles :
Nom : Homme kazamed
Localisation : Tunisie

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : mai 2011
Messages : 13
Points : 1
Points : 1
j'ai une question on peut pas récupéré une variable coder par javascript en php??
ci possible comment !!
kazamed est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 14/05/2011, 14h17   #20
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 823
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

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

Informations forums :
Inscription : mars 2005
Messages : 2 823
Points : 3 449
Points : 3 449
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
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 11h37.


 
 
 
 
Partenaires

Hébergement Web