Bonsoir a tous et merci a ceux qui auront le temps de me lire.

J'ai un formulaire basic, et parmi mes input, j'ai un code en javascript qui me permet de rajouter des champs. Cependant je ne sais pas traiter les tableau array concernant les champ[].

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
 
<?
$valid= @$_GET["valid"];
if ($valid=="ok" and $nom<>""){
$modif=mysql_query("INSERT INTO `personne` (`nom` ,`prenom`)VALUES ( '$nom', '$prenom')");
}
// Sachant que la table contient le champ 'idP' qui s’incrémente a chaque enregistrement
//-----
ICI il faudrait que je sauvegarde les données des champ1[], etc... dans une autre table
$modif=mysql_query("INSERT INTO `champ` (`idP` ,`champ1` ,`champ2` ,`champ3` ,`champ4`)VALUES ( '$idP, .................................)");
// mais je n'arrive pas a recuperer les valeur des tableaux
?
>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
 
<head>
	<meta http-equiv="Content-Type"	content="text/html; charset=ISO-8859-1" />
	<meta name="robots" content="noindex, follow" />
 
	<title></title>
 
<style type="text/css">
table {
	border : 2px solid #666;
	border-collapse : collapse;
}
table thead th {
	background : #369;
	border-bottom : 2px solid #666;
	color : #fff;
}
table tbody td {
	border : 1px solid #ccc;
	padding : 5px 2px;
}
</style>
 
	<script type="text/javascript" src="dtable.js"></script>
</head>
 
<body>
 
	<form action="sauv.php?valid=ok" method="post">
	<input type="text" name="nom" />
	<input type="text" name="prenom" />
 
	<table class="dTable">
		<thead>
			<tr>
				<th>Colonne 1</th>
				<th>Colonne 2</th>
				<th>Colonne 3</th>
				<th>Colonne 4</th>
				<th>Colonne 5</th>
			</tr>
		</thead>
 
		<tfoot>
			<tr>
				<th colspan="5"><a href="#" onclick="addLigne(this); return false;">Ajouter une ligne</a></th>
			</tr>
		</tfoot>
 
		<tbody>
 
			<tr>
				<td><input type="text" name="champ1[]" /></td>
				<td><input type="text" name="champ2[]" /></td>
				<td><input type="text" name="champ3[]" /></td>
				<td><input type="text" name="champ4[]" /></td>
				<td><a href="#" onclick="delLigne(this); return false;">Supp</a></td>
			</tr>
 
		</tbody>
	</table>
 
	<p><input type="submit" value="ok" name="ok" /></p>
 
	</form>
</body>
</html>
Je remercie tout ceux qui pourront m'aider car je galère avec juste cette petite portion du code.

Merci milles fois
Olivier