Bonjour,
Voilà quelques jours que je cherche sans succès. Mon souci est le suivant je crée un tableau dynamique en javascript de la manière suivante :
Code javascript : 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 function membre(){ //Génération tableau var tableau = document.getElementById('tbEquipe'); var createRow = tableau.insertRow(-1); createCell = createRow.insertCell(0); createCell.innerHTML = "<input type='text' name='dataSoc" + iAjax + "' id='dataSoc" + iAjax + "' value='" + document.formEquipe.societe.value + "' disabled='true'/>"; createCell = createRow.insertCell(1); createCell.innerHTML = "<input type='text' name='dataInt" + iAjax + "' id='dataInt" + iAjax + "' value='" + document.formEquipe.intervenant.value + "' disabled='true'/>"; createCell = createRow.insertCell(2); createCell.innerHTML = "Fonction"; createCell = createRow.insertCell(3); createCell.innerHTML = "<input type='text' name='dataFct" + iAjax + "' id='dataFct" + iAjax + "' value='" + iAjax + "'/>"; createCell = createRow.insertCell(4); createCell.innerHTML = 'Pointage'; createCell = createRow.insertCell(5); createCell.innerHTML = "<input type='text' name='' id='id' value=''/>"; createCell = createRow.insertCell(6); createCell.innerHTML = "<input type='text' name='' id='id' value=''/>"; createCell = createRow.insertCell(7); createCell.innerHTML = "<input id='' type='checkbox'>"; createCell = createRow.insertCell(8); createCell.innerHTML = "<input id='' type='checkbox'>"; createCell = createRow.insertCell(9); createCell.innerHTML = "<input id='' type='checkbox'>"; createCell = createRow.insertCell(10); var bouton = document.createElement("input"); bouton.type = "button"; bouton.value = "x"; bouton.className = "supr red"; bouton.onclick = function(){suppression(createRow)}; createCell.appendChild(bouton); iAjax++; document.formEquipe.nbrLigne.value = iAjax; }
Et je cherche à récupérer les données de mon tableau via une variable POST:
Code php : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 if(isset($_POST['ajoutEquipe'])) { $nbre = htmlentities($_POST["nbrLigne"]) ; echo $nbre; for($i=0; $i<$nbre; $i++) { if (isset($_POST['dataInt.$i'])) { $test = htmlentities($_POST['dataInt.$i']) ; echo $test; } } }
Mais rien à y faire, ma variable $test se contente de me renvoyer le nombre de ligne de mon tableau....
Merci d'avance pour votre aide !
Partager